changeset 1803:5752a95053f2

* xterm.c (x_window_to_scrollbar): Search frames' condemned_scrollbars list as well; input might arrive during redisplay. (x_scrollbar_report_motion): Don't forget to BLOCK_INPUT. (XTjudge_scrollbars): Clear the condemned scrollbar list before traversing it, so we don't try to process an event on a scrollbar we've killed.
author Jim Blandy <jimb@redhat.com>
date Sat, 16 Jan 1993 05:58:15 +0000
parents 456ebec04db7
children fe2bebf150c7
files src/xterm.c
diffstat 1 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Fri Jan 15 21:57:50 1993 +0000
+++ b/src/xterm.c	Sat Jan 16 05:58:15 1993 +0000
@@ -1715,7 +1715,7 @@
   for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
     {
       Lisp_Object frame = XCONS (tail)->car;
-      Lisp_Object bar;
+      Lisp_Object bar, condemned;
 
       /* All elements of Vframe_list should be frames.  */
       if (XTYPE (frame) != Lisp_Frame)
@@ -1723,8 +1723,11 @@
 
       /* Scan this frame's scrollbar list for a scrollbar with the
          right window ID.  */
+      condemned = FRAME_CONDEMNED_SCROLLBARS (XFRAME (frame));
       for (bar = FRAME_SCROLLBARS (XFRAME (frame));
-	   ! NILP (bar);
+	   /* This trick allows us to search both the ordinary and
+              condemned scrollbar lists with one loop.  */
+	   ! NILP (bar) || (bar = condemned, condemned = Qnil, ! NILP (bar));
 	   bar = XSCROLLBAR(bar)->next)
 	if (SCROLLBAR_X_WINDOW (XSCROLLBAR (bar)) == window_id)
 	  return XSCROLLBAR (bar);
@@ -2087,9 +2090,13 @@
 {
   Lisp_Object bar, next;
 
-  for (bar = FRAME_CONDEMNED_SCROLLBARS (f);
-       ! NILP (bar);
-       bar = next)
+  bar = FRAME_CONDEMNED_SCROLLBARS (f);
+
+  /* Clear out the condemned list now so we won't try to process any
+     more events on the hapless scrollbars.  */
+  FRAME_CONDEMNED_SCROLLBARS (f) = Qnil;
+
+  for (; ! NILP (bar); bar = next)
     {
       struct scrollbar *b = XSCROLLBAR (bar);
 
@@ -2099,8 +2106,6 @@
       b->next = b->prev = Qnil;
     }
 
-  FRAME_CONDEMNED_SCROLLBARS (f) = Qnil;
-
   /* Now there should be no references to the condemned scrollbars,
      and they should get garbage-collected.  */
 }
@@ -2249,6 +2254,8 @@
   struct scrollbar *bar = XSCROLLBAR (last_mouse_scrollbar);
   int win_x, win_y;
 
+  BLOCK_INPUT;
+
   /* Get the mouse's position relative to the scrollbar window, and
      report that.  */
   {
@@ -2270,7 +2277,7 @@
 			 &dummy_mask))
       {
 	*f = 0;
-	return;
+	goto done;
       }
   }
 
@@ -2307,6 +2314,9 @@
 
   mouse_moved = 0;
   last_mouse_scrollbar = Qnil;
+
+ done:
+  UNBLOCK_INPUT;
 }