Index: /trunk/source/cocoa-ide/cocoa-listener.lisp
===================================================================
--- /trunk/source/cocoa-ide/cocoa-listener.lisp	(revision 15280)
+++ /trunk/source/cocoa-ide/cocoa-listener.lisp	(revision 15281)
@@ -603,5 +603,10 @@
     (make-instance 'sequence-window-controller
       :sequence (cdr (ccl::bt.restarts context))
+      :before-close-function #'(lambda (wc)
+                                 (declare (ignore wc))
+                                 (setf (car (ccl::bt.restarts context)) nil))
       :result-callback #'(lambda (r)
+                           (execute-in-gui #'(lambda ()
+                                               (#/close (car (ccl::bt.restarts context)))))
                            (process-interrupt
                             process
Index: /trunk/source/cocoa-ide/cocoa-utils.lisp
===================================================================
--- /trunk/source/cocoa-ide/cocoa-utils.lisp	(revision 15280)
+++ /trunk/source/cocoa-ide/cocoa-utils.lisp	(revision 15281)
@@ -26,5 +26,6 @@
      (result-callback :initarg :result-callback)
      (display :initform #'(lambda (item stream) (prin1 item stream)) :initarg :display)
-     (title :initform "Sequence dialog" :initarg :title))
+     (title :initform "Sequence dialog" :initarg :title)
+     (before-close-function :initarg :before-close-function :initform nil))
   (:metaclass ns:+ns-object))
 
@@ -37,4 +38,5 @@
          (scrollview (make-instance 'ns:ns-scroll-view :with-frame contentframe)))
     (#/setWindow: self w)
+    (#/release w)
     (#/setDelegate: w self)
     (#/setWindowController: w self)
@@ -73,4 +75,5 @@
 
 (objc:defmethod (#/dealloc :void) ((self sequence-window-controller))
+  (objc:remove-lisp-slots self)
   (call-next-method))
 
@@ -79,4 +82,7 @@
   (declare (ignore notification))
   (#/setDataSource: (slot-value self 'table-view) +null-ptr+)
+  (with-slots (before-close-function) self
+    (when (functionp before-close-function)
+      (funcall before-close-function self)))
   (#/autorelease self))
 
