aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-09-23 20:41:24 +0800
committerPo Lu2022-09-23 20:41:47 +0800
commite359df4217a392bb3185ff7449656c0a8953a6f4 (patch)
tree54b2db4f5f61bd645e947c6927eb49356cd9b0d4 /src
parent8892abbaf92ebd2e8f968fe86270fba08bf1d07a (diff)
downloademacs-e359df4217a392bb3185ff7449656c0a8953a6f4.tar.gz
emacs-e359df4217a392bb3185ff7449656c0a8953a6f4.zip
Fix more toolkit scroll bar window protection issues
* src/xterm.c (handle_one_xevent): Ignore outdated scroll bar events. (x_free_frame_resources): Clear protected windows and invalidate previous scroll bar events. * src/xterm.h (struct x_display_info): New field `first_valid_scroll_bar_req'.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c18
-rw-r--r--src/xterm.h9
2 files changed, 25 insertions, 2 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 6860ef20800..2d366e5511f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -18109,7 +18109,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
18109 /* Unprotect the first window to be sent in a 18109 /* Unprotect the first window to be sent in a
18110 ClientMessage event, since it is now on the stack and 18110 ClientMessage event, since it is now on the stack and
18111 thereby subject to garbage collection. */ 18111 thereby subject to garbage collection. */
18112 x_unprotect_window_for_callback (dpyinfo); 18112 if (event->xclient.serial
18113 >= dpyinfo->first_valid_scroll_bar_req)
18114 x_unprotect_window_for_callback (dpyinfo);
18113 18115
18114 *finish = X_EVENT_GOTO_OUT; 18116 *finish = X_EVENT_GOTO_OUT;
18115 goto done; 18117 goto done;
@@ -18121,7 +18123,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
18121 /* Unprotect the first window to be sent in a 18123 /* Unprotect the first window to be sent in a
18122 ClientMessage event, since it is now on the stack and 18124 ClientMessage event, since it is now on the stack and
18123 thereby subject to garbage collection. */ 18125 thereby subject to garbage collection. */
18124 x_unprotect_window_for_callback (dpyinfo); 18126 if (event->xclient.serial
18127 >= dpyinfo->first_valid_scroll_bar_req)
18128 x_unprotect_window_for_callback (dpyinfo);
18125 18129
18126 *finish = X_EVENT_GOTO_OUT; 18130 *finish = X_EVENT_GOTO_OUT;
18127 goto done; 18131 goto done;
@@ -27339,6 +27343,16 @@ x_free_frame_resources (struct frame *f)
27339#if defined HAVE_XSYNCTRIGGERFENCE && !defined USE_GTK && defined HAVE_CLOCK_GETTIME 27343#if defined HAVE_XSYNCTRIGGERFENCE && !defined USE_GTK && defined HAVE_CLOCK_GETTIME
27340 x_sync_free_fences (f); 27344 x_sync_free_fences (f);
27341#endif 27345#endif
27346
27347#ifdef USE_TOOLKIT_SCROLL_BARS
27348 /* Since the frame was destroyed, we can no longer guarantee
27349 that scroll bar events will be received. Clear
27350 protected_windows, and ignore any preceding scroll bar events
27351 that happen to still be deliverable. */
27352 dpyinfo->n_protected_windows = 0;
27353 dpyinfo->first_valid_scroll_bar_req
27354 = XNextRequest (dpyinfo->display);
27355#endif
27342 } 27356 }
27343 27357
27344#ifdef HAVE_GTK3 27358#ifdef HAVE_GTK3
diff --git a/src/xterm.h b/src/xterm.h
index d6ff15e40f7..d1671621c78 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -839,6 +839,15 @@ struct x_display_info
839 server_time_monotonic_p will be true). */ 839 server_time_monotonic_p will be true). */
840 int_fast64_t server_time_offset; 840 int_fast64_t server_time_offset;
841#endif 841#endif
842
843#if defined USE_TOOLKIT_SCROLL_BARS
844 /* Serial number of the first scroll bar event to start listening
845 to. This is necessary because protected_windows is display
846 local, but the destruction of a frame's edit window may cause
847 event windows to vanish before they are delivered, leading to
848 windows remaining protected indefinitely. */
849 unsigned long first_valid_scroll_bar_req;
850#endif
842}; 851};
843 852
844#ifdef HAVE_X_I18N 853#ifdef HAVE_X_I18N