summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1993-01-16 05:58:15 +0000
committerJim Blandy <jimb@redhat.com>1993-01-16 05:58:15 +0000
commitcf7cb199e517cc684378abe078474d1737d2663d (patch)
treecd1845f18dc20e0254b8995e656339813605638e
parent22d7cb8974141c9131909eec112da4bae8ca3f91 (diff)
downloademacs-cf7cb199e517cc684378abe078474d1737d2663d.tar.gz
* 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.
-rw-r--r--src/xterm.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 2b822384de3..e55685f37e1 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1715,7 +1715,7 @@ x_window_to_scrollbar (window_id)
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 @@ x_window_to_scrollbar (window_id)
/* 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 @@ XTjudge_scrollbars (f)
{
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 @@ XTjudge_scrollbars (f)
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 @@ x_scrollbar_report_motion (f, bar_window, part, x, y, time)
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 @@ x_scrollbar_report_motion (f, bar_window, part, x, y, time)
&dummy_mask))
{
*f = 0;
- return;
+ goto done;
}
}
@@ -2307,6 +2314,9 @@ x_scrollbar_report_motion (f, bar_window, part, x, y, time)
mouse_moved = 0;
last_mouse_scrollbar = Qnil;
+
+ done:
+ UNBLOCK_INPUT;
}