Changeset 14204


Ignore:
Timestamp:
Aug 21, 2010, 10:42:55 AM (9 years ago)
Author:
gb
Message:

Reorganize some of the editor object cleanup code; do explicit
#/release, remove lisp slots in #/dealloc methods, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/cocoa-editor.lisp

    r14160 r14204  
    282282  (:metaclass ns:+ns-object))
    283283
     284
     285 
    284286(defmethod hemlock-buffer ((self hemlock-buffer-string))
    285287  (let ((cache (hemlock-buffer-string-cache self)))
     
    307309  workline-start-font-index             ; current font index at start of workline
    308310  )
     311
     312(objc:defmethod (#/dealloc :void) ((self hemlock-buffer-string))
     313  (let* ((cache (hemlock-buffer-string-cache self))
     314         (buffer (if cache (buffer-cache-buffer cache))))
     315    (when buffer
     316      (setf (buffer-cache-buffer cache) nil
     317            (slot-value self 'cache) nil
     318            (hi::buffer-document buffer) nil)
     319      (when (eq buffer hi::*current-buffer*)
     320        (setf hi::*current-buffer* nil))
     321      (hi::delete-buffer buffer)))
     322  (objc:remove-lisp-slots self)
     323  (call-next-method))
    309324
    310325(defmethod hemlock-buffer ((self buffer-cache))
     
    869884  (let* ((hemlock-string (slot-value ts 'hemlock-string)))
    870885    (setf (slot-value ts 'hemlock-string) +null-ptr+)
    871    
    872886    (unless (%null-ptr-p hemlock-string)
    873       (let* ((cache (hemlock-buffer-string-cache hemlock-string))
    874              (buffer (if cache (buffer-cache-buffer cache))))
    875         (when buffer
    876           (setf (buffer-cache-buffer cache) nil
    877                 (slot-value hemlock-string 'cache) nil
    878                 (hi::buffer-document buffer) nil)
    879           (when (eq buffer hi::*current-buffer*)
    880             (setf hi::*current-buffer* nil))
    881           (hi::delete-buffer buffer))))))
     887      (#/release hemlock-string))))
    882888
    883889
     
    20492055  (call-next-method edited))
    20502056
     2057(objc:defmethod (#/dealloc :void) ((self hemlock-frame))
     2058  (let* ((pane (slot-value self 'pane))
     2059         (echo-view (slot-value self 'echo-area-view)))
     2060    (unless (%null-ptr-p pane)
     2061      (setf (slot-value self 'pane) (%null-ptr))
     2062      (#/release pane))
     2063    (unless (%null-ptr-p echo-view)
     2064      (setf (slot-value self 'echo-area-view) (%null-ptr))
     2065      (#/release echo-view))
     2066    (objc:remove-lisp-slots self)
     2067    (call-next-method)))
     2068 
    20512069
    20522070(objc:defmethod (#/miniaturize: :void) ((w hemlock-frame) sender)
     
    29182936      (setf (slot-value self 'textstorage) (%null-ptr))
    29192937      (close-hemlock-textstorage textstorage)))
     2938  (objc:remove-lisp-slots self)
    29202939  (call-next-method))
    29212940
Note: See TracChangeset for help on using the changeset viewer.