Subject: Re: bug#21313: 25.0.50; Strange errors from dbus-handle-event

From: Eli Zaretskii <[email-masked]>
Date: Sat, 03 Oct 2015 10:14:24 +0300

> From: Tassilo Horn <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],  [email-masked]
> Date: Sat, 03 Oct 2015 08:32:56 +0200
> 
> Can someone give me a hint what I'm doing wrong?  With the changes below
> keyboard.c still compiles but the step
> 
>   ./temacs --batch --load loadup bootstrap
> 
> starts using up all my RAM and swap space until I kill it.
> 
> --8<---------------cut here---------------start------------->8---
> modified   src/keyboard.c
> @@ -3412,6 +3412,11 @@ kbd_buffer_nr_stored (void)
>  void
>  kbd_buffer_store_event (register struct input_event *event)
>  {
> +  Faset (Vth_event_buffer, Vth_event_buffer_idx, make_lispy_event (event));
> +  if (Vth_event_buffer_idx == 99)
> +    Vth_event_buffer_idx = 0;
> +  else
> +    Vth_event_buffer_idx++;
>    kbd_buffer_store_event_hold (event, 0);
>  }
>  
> @@ -11131,6 +11136,14 @@ syms_of_keyboard (void)
>    defsubr (&Sposn_at_point);
>    defsubr (&Sposn_at_x_y);
>  
> +  DEFVAR_LISP ("th-input-event-buffer", Vth_event_buffer,
> +	       doc: /* The last 100 events.  */);
> +  Vth_event_buffer = Fmake_vector(100, 0);

Fmake_vector needs a Lisp integer as its first argument, i.e. you need
to use make_number.  (And I'd suggest to use Qnil or some other Lisp
object as the second, not a C zero, although currently Qnil's value is
indeed zero.)