]> git.eshelyaron.com Git - emacs.git/commitdiff
Handle allocation errors when interning large amounts of atoms
authorPo Lu <luangruo@yahoo.com>
Sat, 11 Jun 2022 03:13:48 +0000 (11:13 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 11 Jun 2022 03:13:48 +0000 (11:13 +0800)
* src/xfns.c (Fx_begin_drag): Catch BadAlloc errors around
XInternAtoms.

src/xfns.c

index 43d4d27372e41b1d73b42d6be50dfa738fd9c41f..9882fd7ce1133892eca2cc790ffde9799d3b712f 100644 (file)
@@ -6982,10 +6982,14 @@ that mouse buttons are being held down, such as immediately after a
 
   target_atoms = SAFE_ALLOCA (ntargets * sizeof *target_atoms);
 
-  block_input ();
+  /* Catch errors since interning lots of targets can potentially
+     generate a BadAlloc error.  */
+  x_catch_errors (FRAME_X_DISPLAY (f));
   XInternAtoms (FRAME_X_DISPLAY (f), target_names,
                ntargets, False, target_atoms);
-  unblock_input ();
+  x_check_errors (FRAME_X_DISPLAY (f),
+                 "Failed to intern target atoms: %s");
+  x_uncatch_errors_after_check ();
 
   lval = x_dnd_begin_drag_and_drop (f, FRAME_DISPLAY_INFO (f)->last_user_time,
                                    xaction, return_frame, action_list,