Index: /trunk/source/cocoa-ide/cocoa-editor.lisp
===================================================================
--- /trunk/source/cocoa-ide/cocoa-editor.lisp	(revision 14203)
+++ /trunk/source/cocoa-ide/cocoa-editor.lisp	(revision 14204)
@@ -282,4 +282,6 @@
   (:metaclass ns:+ns-object))
 
+
+  
 (defmethod hemlock-buffer ((self hemlock-buffer-string))
   (let ((cache (hemlock-buffer-string-cache self)))
@@ -307,4 +309,17 @@
   workline-start-font-index		; current font index at start of workline
   )
+
+(objc:defmethod (#/dealloc :void) ((self hemlock-buffer-string))
+  (let* ((cache (hemlock-buffer-string-cache self))
+         (buffer (if cache (buffer-cache-buffer cache))))
+    (when buffer
+      (setf (buffer-cache-buffer cache) nil
+            (slot-value self 'cache) nil
+            (hi::buffer-document buffer) nil)
+      (when (eq buffer hi::*current-buffer*)
+        (setf hi::*current-buffer* nil))
+      (hi::delete-buffer buffer)))
+  (objc:remove-lisp-slots self)
+  (call-next-method))
 
 (defmethod hemlock-buffer ((self buffer-cache))
@@ -869,15 +884,6 @@
   (let* ((hemlock-string (slot-value ts 'hemlock-string)))
     (setf (slot-value ts 'hemlock-string) +null-ptr+)
-    
     (unless (%null-ptr-p hemlock-string)
-      (let* ((cache (hemlock-buffer-string-cache hemlock-string))
-             (buffer (if cache (buffer-cache-buffer cache))))
-        (when buffer
-          (setf (buffer-cache-buffer cache) nil
-                (slot-value hemlock-string 'cache) nil
-                (hi::buffer-document buffer) nil)
-          (when (eq buffer hi::*current-buffer*)
-	    (setf hi::*current-buffer* nil))
-	  (hi::delete-buffer buffer))))))
+      (#/release hemlock-string))))
 
 
@@ -2049,4 +2055,16 @@
   (call-next-method edited))
 
+(objc:defmethod (#/dealloc :void) ((self hemlock-frame))
+  (let* ((pane (slot-value self 'pane))
+         (echo-view (slot-value self 'echo-area-view)))
+    (unless (%null-ptr-p pane)
+      (setf (slot-value self 'pane) (%null-ptr))
+      (#/release pane))
+    (unless (%null-ptr-p echo-view)
+      (setf (slot-value self 'echo-area-view) (%null-ptr))
+      (#/release echo-view))
+    (objc:remove-lisp-slots self)
+    (call-next-method)))
+  
 
 (objc:defmethod (#/miniaturize: :void) ((w hemlock-frame) sender)
@@ -2918,4 +2936,5 @@
       (setf (slot-value self 'textstorage) (%null-ptr))
       (close-hemlock-textstorage textstorage)))
+  (objc:remove-lisp-slots self)
   (call-next-method))
 
