emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a5405e5644: Fix GC protection of scroll bar windows


From: Po Lu
Subject: master a5405e5644: Fix GC protection of scroll bar windows
Date: Sun, 18 Sep 2022 21:36:54 -0400 (EDT)

branch: master
commit a5405e56449e90203db909ea4ed1b19500e5044b
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix GC protection of scroll bar windows
    
    * src/xterm.c (x_atom_refs): Add _EMACS prefix to
    vendor-specific scroll-bar atoms.
    (handle_one_xevent): Unprotect windows immediately upon
    receiving an _EMACS_SCROLLBAR event, instead of waiting for the
    event to be put on the keyboard buffer.  Reported by martin
    rudalics <rudalics@gmx.at>.
---
 src/xterm.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index cb6581b78c..245306c67c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -970,8 +970,8 @@ static const struct x_atom_ref x_atom_refs[] =
     /* Ghostscript support.  */
     ATOM_REFS_INIT ("DONE", Xatom_DONE)
     ATOM_REFS_INIT ("PAGE", Xatom_PAGE)
-    ATOM_REFS_INIT ("SCROLLBAR", Xatom_Scrollbar)
-    ATOM_REFS_INIT ("HORIZONTAL_SCROLLBAR", Xatom_Horizontal_Scrollbar)
+    ATOM_REFS_INIT ("_EMACS_SCROLLBAR", Xatom_Scrollbar)
+    ATOM_REFS_INIT ("_EMACS_HORIZONTAL_SCROLLBAR", Xatom_Horizontal_Scrollbar)
     ATOM_REFS_INIT ("_XEMBED", Xatom_XEMBED)
     /* EWMH */
     ATOM_REFS_INIT ("_NET_WM_STATE", Xatom_net_wm_state)
@@ -18103,12 +18103,24 @@ handle_one_xevent (struct x_display_info *dpyinfo,
         if (event->xclient.message_type == dpyinfo->Xatom_Scrollbar)
           {
             x_scroll_bar_to_input_event (event, &inev.ie);
+
+           /* 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);
+
            *finish = X_EVENT_GOTO_OUT;
             goto done;
           }
         else if (event->xclient.message_type == 
dpyinfo->Xatom_Horizontal_Scrollbar)
           {
             x_horizontal_scroll_bar_to_input_event (event, &inev.ie);
+
+           /* 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);
+
            *finish = X_EVENT_GOTO_OUT;
             goto done;
           }
@@ -23709,12 +23721,6 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       count++;
     }
 
-#ifdef USE_TOOLKIT_SCROLL_BARS
-  if (event->xany.type == ClientMessage
-      && inev.ie.kind == SCROLL_BAR_CLICK_EVENT)
-    x_unprotect_window_for_callback (dpyinfo);
-#endif
-
   if (do_help
       && !(hold_quit && hold_quit->kind != NO_EVENT))
     {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]