]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Motif DND after atom ownership is lost due to frame destruction
authorPo Lu <luangruo@yahoo.com>
Thu, 16 Jun 2022 05:58:39 +0000 (13:58 +0800)
committerPo Lu <luangruo@yahoo.com>
Thu, 16 Jun 2022 06:00:27 +0000 (14:00 +0800)
* src/xterm.c (xm_get_drag_atom_1): Record owner.
(x_free_frame_resources): Clear drag atom if owner was freed.
* src/xterm.h (struct x_display_info): New field
`motif_drag_atom_owner'.

src/xterm.c
src/xterm.h

index cc47427a9d7f8f355ae88eede41938164d778f9c..04e3223478f6219638fc5e98f2b91e01304a583f 100644 (file)
@@ -2281,6 +2281,7 @@ xm_get_drag_atom_1 (struct x_display_info *dpyinfo,
     }
 
   dpyinfo->motif_drag_atom_time = dpyinfo->last_user_time;
+  dpyinfo->motif_drag_atom_owner = source_frame;
 
   XUngrabServer (dpyinfo->display);
   return atom;
@@ -25310,6 +25311,12 @@ x_free_frame_resources (struct frame *f)
     g_object_unref (FRAME_OUTPUT_DATA (f)->scrollbar_foreground_css_provider);
 #endif
 
+  if (f == dpyinfo->motif_drag_atom_owner)
+    {
+      dpyinfo->motif_drag_atom_owner = NULL;
+      dpyinfo->motif_drag_atom = None;
+    }
+
   if (f == dpyinfo->x_focus_frame)
     dpyinfo->x_focus_frame = 0;
   if (f == dpyinfo->x_focus_event_frame)
index 119382c73ceb412652634e6563bc8e17347de703..ad0df6bff93f403705177016ca4b9b4575b7e1a2 100644 (file)
@@ -576,6 +576,9 @@ struct x_display_info
   /* When it was owned.  */
   Time motif_drag_atom_time;
 
+  /* The frame that currently owns `motif_drag_atom'.  */
+  struct frame *motif_drag_atom_owner;
+
   /* Extended window manager hints, Atoms supported by the window manager and
      atoms for setting the window type.  */
   Atom Xatom_net_supported, Xatom_net_supporting_wm_check;