diff options
author | Po Lu <luangruo@yahoo.com> | 2022-09-23 20:41:24 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-09-23 20:41:47 +0800 |
commit | e359df4217a392bb3185ff7449656c0a8953a6f4 (patch) | |
tree | 54b2db4f5f61bd645e947c6927eb49356cd9b0d4 /src/xterm.c | |
parent | 8892abbaf92ebd2e8f968fe86270fba08bf1d07a (diff) | |
download | emacs-e359df4217a392bb3185ff7449656c0a8953a6f4.tar.gz |
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/xterm.c')
-rw-r--r-- | src/xterm.c | 18 |
1 files changed, 16 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, /* Unprotect the first window to be sent in a ClientMessage event, since it is now on the stack and thereby subject to garbage collection. */ - x_unprotect_window_for_callback (dpyinfo); + if (event->xclient.serial + >= dpyinfo->first_valid_scroll_bar_req) + x_unprotect_window_for_callback (dpyinfo); *finish = X_EVENT_GOTO_OUT; goto done; @@ -18121,7 +18123,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, /* Unprotect the first window to be sent in a ClientMessage event, since it is now on the stack and thereby subject to garbage collection. */ - x_unprotect_window_for_callback (dpyinfo); + if (event->xclient.serial + >= dpyinfo->first_valid_scroll_bar_req) + x_unprotect_window_for_callback (dpyinfo); *finish = X_EVENT_GOTO_OUT; goto done; @@ -27339,6 +27343,16 @@ x_free_frame_resources (struct frame *f) #if defined HAVE_XSYNCTRIGGERFENCE && !defined USE_GTK && defined HAVE_CLOCK_GETTIME x_sync_free_fences (f); #endif + +#ifdef USE_TOOLKIT_SCROLL_BARS + /* Since the frame was destroyed, we can no longer guarantee + that scroll bar events will be received. Clear + protected_windows, and ignore any preceding scroll bar events + that happen to still be deliverable. */ + dpyinfo->n_protected_windows = 0; + dpyinfo->first_valid_scroll_bar_req + = XNextRequest (dpyinfo->display); +#endif } #ifdef HAVE_GTK3 |