edwin/xterm.scm (preview-event-stream): Use dynamic-wind.
authorMatt Birkholz <puck@birchwood-abbey.net>
Fri, 5 Aug 2016 22:07:50 +0000 (15:07 -0700)
committerMatt Birkholz <puck@birchwood-abbey.net>
Sun, 7 Aug 2016 17:57:12 +0000 (10:57 -0700)
src/edwin/xterm.scm

index 18cab574c8ef1be3e1d7fffebcff1572a0157c82..182fbf18302c99748a7c86b68e3767208ad195c4 100644 (file)
@@ -592,13 +592,17 @@ USA.
 
      (define (preview-events mode)
        mode
-       (if previewer-registration
-          (register!))
-       (let loop ()
-        (let ((event (x-display-process-events x-display-data 2)))
-          (if event
-              (begin (preview-event event x-display-events)
-                     (loop))))))
+       (dynamic-wind
+       (lambda () unspecific)
+       (lambda ()
+         (let loop ()
+           (let ((event (x-display-process-events x-display-data 2)))
+             (if event
+                 (begin (preview-event event x-display-events)
+                        (loop))))))
+       (lambda ()
+         (if previewer-registration
+             (register!)))))
 
      (register!))))