[Openmcl-devel] YAWC (Yet Another Weird Crash)

Ron Garret ron at awun.net
Thu May 28 14:52:17 PDT 2009


Still trying to display PDF files.  It's mostly working, but I've  
encountered another weird (to me) problem.  I can display multiple PDF  
files in multiple windows, but if I try to move a PDF file from one  
window to a different one I get crashes.  The two weird things are  
that the crashes are pretty reliable, but not 100% reproducible.   
Every now and then I get a session where the crash seems to not  
happen.  And also the crash is set up by moving a PDF from one window  
to another, but it doesn't actually happen until you try to scroll or  
resize the window.  Demo code follows.  I've already checked the  
obvious things like the reference counts on the PDF files dropping to  
zero and everything seems OK.

Thanks,
rg
---

(in-package "CL-USER")

(objc:load-framework "Quartz" :quartz)
(defun nsstr (s) (make-instance 'gui::ns-lisp-string :string s))

(defun pdf-from-url (url)
   (make-instance ns:pdf-document :init-with-url
         (make-instance ns:ns-url :init-with-string url)))

(defun make-ns-window (x y &optional (title "Untitled"))
   (let ((nsw (make-instance 'ns:ns-window
             :with-content-rect (ns:make-ns-rect 0 0 x y)
             :style-mask 15
             :backing #$NSBackingStoreBuffered
             :defer t)))
       (#/setTitle: nsw (nsstr title))
       (#/setReleasedWhenClosed: nsw nil)
       (#/center nsw)
       (#/orderFront: nsw nil)
       nsw))

(setf p1 (pdf-from-url #@"http://www.flownet.com/ron/test.pdf"))
(setf v1 (#/init (#/alloc ns:pdf-view)))
(setf w1 (make-ns-window 400 600 "W1"))
(#/setContentView: w1 v1)

(setf p2 (pdf-from-url #@"http://www.flownet.com/ron/specials.pdf"))
(setf v2 (#/init (#/alloc ns:pdf-view)))
(setf w2 (make-ns-window 400 600 "W2"))
(#/setContentView: w2 v2)

(#/setDocument: v1 p1)
(#/setDocument: v2 p2)

(#/setDocument: v1 nil)
(#/setDocument: v1 p1)

(#/setDocument: v2 nil)
(#/setDocument: v2 p2)

; Stop here and try scrolling and resizing the windows.  It should  
still work.

(#/setDocument: v1 nil)
(#/setDocument: v2 nil)
(#/setDocument: v1 p2)
(#/setDocument: v2 p1)

; Scrolling and resizing at this point should cause CCL to crash




More information about the Openmcl-devel mailing list