# HG changeset patch # User Jim Blandy # Date 727163895 0 # Node ID 5752a95053f2c347cac5973db150ef11de4ea11e # Parent 456ebec04db73da9c9493d4e2ba0612994cef60a * 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. diff -r 456ebec04db7 -r 5752a95053f2 src/xterm.c --- 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; }