Commit 3fb8e5d7 authored by Karoly Lorentey's avatar Karoly Lorentey

Fix assertion on kboard->kbd_queue and other such crashes.

* src/keyboard.c (pop_kboard): Set current_kboard to the kboard of the
  selected frame when the stored kboard object has been deleted before
  (restore_kboard_configuration): Call pop_kboard only after setting up
  single_kboard mode.

parent 26cbc048
......@@ -393,6 +393,10 @@ THINGS TO DO
** frames-on-display-list should also accept frames.
** I smell something funny around pop_kboard's "deleted kboard" case.
Determine what are the circumstances of this case, and fix any
bug that comes to light.
** Consider the `tty-type' frame parameter and the `display-tty-type'
function. They serve the exact same purpose. I think it may be
a good idea to eliminate one of them, preferably `tty-type'.
......@@ -1138,8 +1138,23 @@ void
pop_kboard ()
struct device *d;
struct kboard_stack *p = kboard_stack;
current_kboard = p->kboard;
int ok = 0;
current_kboard = NULL;
for (d = device_list; d; d = d->next_device)
if (d->kboard == p->kboard)
current_kboard = p->kboard;
if (current_kboard == NULL)
/* The display we remembered has been deleted. */
current_kboard = FRAME_KBOARD (SELECTED_FRAME ());
kboard_stack = p->next;
xfree (p);
......@@ -1177,11 +1192,11 @@ static Lisp_Object
restore_kboard_configuration (was_locked)
Lisp_Object was_locked;
pop_kboard ();
if (NILP (was_locked))
any_kboard_state ();
single_kboard_state ();
pop_kboard ();
return Qnil;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment