emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/exwm 6bd85db 2/7: * exwm-manage.el (exwm-manage--scan):


From: Chris Feng
Subject: [elpa] externals/exwm 6bd85db 2/7: * exwm-manage.el (exwm-manage--scan): Check for possibly
Date: Fri, 12 Aug 2016 14:38:50 +0000 (UTC)

branch: externals/exwm
commit 6bd85db30053b493e079893af0ef9668d134057d
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>

    * exwm-manage.el (exwm-manage--scan): Check for possibly
    destroyed child.
---
 exwm-manage.el |   25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/exwm-manage.el b/exwm-manage.el
index a8713ff..1dfd3c9 100644
--- a/exwm-manage.el
+++ b/exwm-manage.el
@@ -389,16 +389,23 @@ manager is shutting down."
 (defun exwm-manage--scan ()
   "Search for existing windows and try to manage them."
   (let* ((tree (xcb:+request-unchecked+reply exwm--connection
-                   (make-instance 'xcb:QueryTree :window exwm--root))))
+                   (make-instance 'xcb:QueryTree
+                                  :window exwm--root)))
+         reply)
     (dolist (i (slot-value tree 'children))
-      (with-slots (override-redirect map-state)
-          (xcb:+request-unchecked+reply exwm--connection
-              (make-instance 'xcb:GetWindowAttributes :window i))
-        (when (and (= 0 override-redirect) (= xcb:MapState:Viewable map-state))
-          (xcb:+request exwm--connection
-              (make-instance 'xcb:UnmapWindow :window i))
-          (xcb:flush exwm--connection)
-          (exwm-manage--manage-window i))))))
+      (setq reply (xcb:+request-unchecked+reply exwm--connection
+                      (make-instance 'xcb:GetWindowAttributes
+                                     :window i)))
+      ;; It's possible the X window has been destroyed.
+      (when reply
+        (with-slots (override-redirect map-state) reply
+          (when (and (= 0 override-redirect)
+                     (= xcb:MapState:Viewable map-state))
+            (xcb:+request exwm--connection
+                (make-instance 'xcb:UnmapWindow
+                               :window i))
+            (xcb:flush exwm--connection)
+            (exwm-manage--manage-window i)))))))
 
 (defvar exwm-manage--ping-lock nil
   "Non-nil indicates EXWM is pinging a window.")



reply via email to

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