emacs-diffs
[Top][All Lists]
Advanced

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

master 9c27c7f7ce: Handle allocation errors when interning large amounts


From: Po Lu
Subject: master 9c27c7f7ce: Handle allocation errors when interning large amounts of atoms
Date: Fri, 10 Jun 2022 23:14:02 -0400 (EDT)

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

    Handle allocation errors when interning large amounts of atoms
    
    * src/xfns.c (Fx_begin_drag): Catch BadAlloc errors around
    XInternAtoms.
---
 src/xfns.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/xfns.c b/src/xfns.c
index 43d4d27372..9882fd7ce1 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -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,



reply via email to

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