changeset 83378:3b40dd9f3d92

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
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 11 Sep 2005 09:34:22 +0000
parents f56539fbe27c
children 23f939241b7d
files README.multi-tty src/keyboard.c
diffstat 2 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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'.
--- 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;
 }