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

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

[elpa] externals/xelb cc63bab 1/2: * xcb.el (xcb:disconnect): Check befo


From: Chris Feng
Subject: [elpa] externals/xelb cc63bab 1/2: * xcb.el (xcb:disconnect): Check before disconnecting.
Date: Sun, 31 Jul 2016 05:18:28 +0000 (UTC)

branch: externals/xelb
commit cc63bab0e6118c4cd6b659d3ed16e511c8fa8eba
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>

    * xcb.el (xcb:disconnect): Check before disconnecting.
---
 xcb.el |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/xcb.el b/xcb.el
index 2e52e36..712d4c2 100644
--- a/xcb.el
+++ b/xcb.el
@@ -367,13 +367,14 @@ Concurrency is disabled as it breaks the orders of 
errors, replies and events."
 
 (cl-defmethod xcb:disconnect ((obj xcb:connection))
   "Disconnect from X server."
-  (xcb:flush obj)
-  (delete-process (slot-value obj 'process))
-  ;; Reset every slot to its default value
-  (let ((slots (eieio-class-slots 'xcb:connection)))
-    (dolist (slot slots)
-      (setf (slot-value obj (eieio-slot-descriptor-name slot))
-            (eieio-oref-default obj (eieio-slot-descriptor-name slot))))))
+  (when (slot-value obj 'connected)
+    (xcb:flush obj)
+    (delete-process (slot-value obj 'process))
+    ;; Reset every slot to its default value
+    (let ((slots (eieio-class-slots 'xcb:connection)))
+      (dolist (slot slots)
+        (setf (slot-value obj (eieio-slot-descriptor-name slot))
+              (eieio-oref-default obj (eieio-slot-descriptor-name slot)))))))
 
 ;;;; Other routines
 



reply via email to

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