emacs-diffs
[Top][All Lists]
Advanced

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

master 7c4a780721 2/2: Prevent errors when Lisp code asks for props of i


From: Po Lu
Subject: master 7c4a780721 2/2: Prevent errors when Lisp code asks for props of invalid windows
Date: Tue, 24 May 2022 09:01:35 -0400 (EDT)

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

    Prevent errors when Lisp code asks for props of invalid windows
    
    * src/xfns.c (Fx_window_property):
    (Fx_window_property_attributes): Catch X errors.
---
 src/xfns.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/xfns.c b/src/xfns.c
index 94077e0af4..e1f8947d55 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -7563,6 +7563,8 @@ if PROP has no value of TYPE (always a string in the MS 
Windows case). */)
     }
 
   block_input ();
+  x_catch_errors (FRAME_X_DISPLAY (f));
+
   if (STRINGP (type))
     {
       if (strcmp ("AnyPropertyType", SSDATA (type)) == 0)
@@ -7593,6 +7595,9 @@ if PROP has no value of TYPE (always a string in the MS 
Windows case). */)
                                              &found);
     }
 
+  x_check_errors (FRAME_X_DISPLAY (f),
+                 "Can't retrieve window property: %s");
+  x_uncatch_errors_after_check ();
 
   unblock_input ();
   return prop_value;
@@ -7638,6 +7643,7 @@ Otherwise, the return value is a vector with the 
following fields:
 
   block_input ();
 
+  x_catch_errors (FRAME_X_DISPLAY (f));
   prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False);
   rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window,
                           prop_atom, 0, 0, False, AnyPropertyType,
@@ -7668,6 +7674,10 @@ Otherwise, the return value is a vector with the 
following fields:
                         make_fixnum (bytes_remaining / (actual_format >> 3)));
     }
 
+  x_check_errors (FRAME_X_DISPLAY (f),
+                 "Can't retrieve window property: %s");
+  x_uncatch_errors_after_check ();
+
   unblock_input ();
   return prop_attr;
 }



reply via email to

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