--- slime.el	19 Jul 2008 11:34:19 -0000	1.949
+++ slime.el	22 Jul 2008 14:10:33 -0000
@@ -6399,9 +6399,10 @@
   "Quit lisp, kill the inferior process and associated buffers."
   (interactive)
   (slime-eval-async '(swank:quit-lisp))
-  (kill-buffer (slime-output-buffer))
-  (set-process-filter (slime-connection) nil)
-  (set-process-sentinel (slime-connection) 'slime-quit-sentinel))
+  (let ((connection (slime-connection)))
+    (kill-buffer (slime-output-buffer))
+    (set-process-filter connection  nil)
+    (set-process-sentinel connection 'slime-quit-sentinel)))
 
 (defun slime-quit-sentinel (process message)
   (assert (process-status process) 'closed)
