]> git.eshelyaron.com Git - emacs.git/commitdiff
Handle bad actual actions during DND
authorPo Lu <luangruo@yahoo.com>
Sun, 17 Apr 2022 13:23:35 +0000 (21:23 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 17 Apr 2022 13:25:25 +0000 (21:25 +0800)
* src/xterm.c (x_dnd_begin_drag_and_drop): Behave correctly when
the target gives us a bad atom.

src/xterm.c

index ab4dcc3841aa2865d386b6f2bd81c86ae877fe83..4241b4d0d6b57070bbe267bddc1f62db5d77cbce 100644 (file)
@@ -9844,10 +9844,18 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
   if (x_dnd_action != None)
     {
       block_input ();
+      x_catch_errors (FRAME_X_DISPLAY (f));
       atom_name = XGetAtomName (FRAME_X_DISPLAY (f),
                                x_dnd_action);
-      action = intern (atom_name);
-      XFree (atom_name);
+      x_uncatch_errors ();
+
+      if (atom_name)
+       {
+         action = intern (atom_name);
+         XFree (atom_name);
+       }
+      else
+       action = Qnil;
       unblock_input ();
 
       return action;