# HG changeset patch # User Karoly Lorentey # Date 1126431262 0 # Node ID 3b40dd9f3d92338014ac258b2b25bcdd95e54fc2 # Parent f56539fbe27cb1d468059c5bea42f4986792a2a9 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 pop_kboard. (restore_kboard_configuration): Call pop_kboard only after setting up single_kboard mode. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-418 diff -r f56539fbe27c -r 3b40dd9f3d92 README.multi-tty --- a/README.multi-tty Sun Sep 11 08:27:02 2005 +0000 +++ b/README.multi-tty Sun Sep 11 09:34:22 2005 +0000 @@ -393,6 +393,10 @@ ** 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'. diff -r f56539fbe27c -r 3b40dd9f3d92 src/keyboard.c --- a/src/keyboard.c Sun Sep 11 08:27:02 2005 +0000 +++ b/src/keyboard.c Sun Sep 11 09:34:22 2005 +0000 @@ -1138,8 +1138,23 @@ pop_kboard () { #ifdef MULTI_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; + break; + } + } + if (current_kboard == NULL) + { + /* The display we remembered has been deleted. */ + current_kboard = FRAME_KBOARD (SELECTED_FRAME ()); + } kboard_stack = p->next; xfree (p); #endif @@ -1177,11 +1192,11 @@ restore_kboard_configuration (was_locked) Lisp_Object was_locked; { - pop_kboard (); if (NILP (was_locked)) any_kboard_state (); else single_kboard_state (); + pop_kboard (); return Qnil; }