[Openmcl-devel] untitled cocoa windows problem

Arthur Cater arthur.cater at ucd.ie
Sat Feb 25 12:16:51 PST 2012


I have a MacBook Pro os10.6.8,
" Welcome to Clozure Common Lisp Version 1.7-r15184M  (DarwinX8664)!"

I'm having trouble with subclassing ns-document. The code below exemplifies.
When a Hemlock view is created using   (my nil)   it is unexceptional, but
when created with   (my t)   there is a problem. In this case, the document of the
window of the view is made to be of subclass ns::my-document, which has no
special methods and no extra slots.

When such a view is made, then closed, and another one made, an error appears
in AltConsole to the effect that there is already a buffer named "Untitled 2".
This does not happen when the document's class is left untouched.

Incidentally, while searching ccl sources, I came upon something that suggested
a similar phenomenon might happen with Listener windows, and it does but for a quite
different reason. Open a new listener, close the first one, open another new listener - bang!
The listener case is caused by incrementing and decrementing a counter that is used
to choose new names. I do not understand what is causing the problem with my
subclassed documents, and would really appreciate help.

Arthur

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cutdown.lisp
Type: application/octet-stream
Size: 927 bytes
Desc: not available
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20120225/0649079e/attachment.obj>
-------------- next part --------------
     contents included below ...

(in-package hemlock)

;;; Scratch windows' documents have their ns:isa slots reset
(defclass ns::my-ns-document (ns:ns-document)
         ()
         (:metaclass ns:+ns-object))
(declaim (special ns::my-ns-document))

(defun cl-user::my (&optional (scratch-p t))
  (gui::execute-in-gui
   (lambda nil
     (let* ((hview (gui::find-or-make-hemlock-view nil))
            (buffer (hemlock-view-buffer hview))
            (window (#/window (hi::hemlock-view-pane hview)))
            (wc (#/windowController window))
            (document (#/document wc))
            (stream (hi:make-hemlock-output-stream (buffer-end-mark buffer) :none)))
       ; All possible values {:none, :line, :full} have identical effect)
       (#/setTitle: window (objc::make-nsstring (copy-seq "My title")))
       (when scratch-p
         (setf (slot-value document 'ns:isa) (find-class 'ns::my-ns-document)))
       (format stream "A change~%")))))



More information about the Openmcl-devel mailing list