branch: externals/xelb commit 36b54b44987c2b05e0a78f7783373e977d706489 Author: Chris Feng <chris.w.f...@gmail.com> Commit: Chris Feng <chris.w.f...@gmail.com>
Handle nonlocal exits when calling event handlers * xcb.el (xcb:-connection-filter): Do cleanups from nonlocal exits. --- xcb.el | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/xcb.el b/xcb.el index 68d4b8d..6b1b9e6 100644 --- a/xcb.el +++ b/xcb.el @@ -310,14 +310,15 @@ Concurrency is disabled as it breaks the orders of errors, replies and events." (with-slots (event-lock event-queue) connection (unless (< 0 event-lock) (cl-incf event-lock) - (let (event data synthetic) - (while (setq event (pop event-queue)) - (setq data (aref event 1) - synthetic (aref event 2)) - (dolist (listener (aref event 0)) - (with-demoted-errors "[XELB ERROR] %S" - (funcall listener data synthetic))))) - (cl-decf event-lock)))))) + (unwind-protect + (let (event data synthetic) + (while (setq event (pop event-queue)) + (setq data (aref event 1) + synthetic (aref event 2)) + (dolist (listener (aref event 0)) + (with-demoted-errors "[XELB ERROR] %S" + (funcall listener data synthetic))))) + (cl-decf event-lock))))))) (cl-defmethod xcb:disconnect ((obj xcb:connection)) "Disconnect from X server."