Re: Removed view still getting events
Re: Removed view still getting events
- Subject: Re: Removed view still getting events
- From: j o a r <email@hidden>
- Date: Fri, 29 Sep 2006 21:00:48 +0200
On 29 sep 2006, at 20.44, John Nairn wrote:
Here are some NSLog()'s. It is removed from its superview and gets
deallocated, but it seems not until the end of the event loop.
NairnFEAMPM[15607] 3D windowDidLoad
NairnFEAMPM[15607] view: <TrackingGraphView: 0x6dfa20>, superview:
<NSClipView: 0x6df7a0>
NairnFEAMPM[15607] view: <TrackingGraphView: 0x6dfa20>, superview:
(null)
NairnFEAMPM[15607] 3D windowDidLoad ended
NairnFEAMPM[15607] openGL reshape
NairnFEAMPM[15607] drawRect
NairnFEAMPM[15607] dealloc TrackingGraphView
The first mouseEntered event after it is deallocated causes a crash
because that view was handling that event and it is now gone and
for some reason still getting the event.
It's not obvious what objects are logging what messages above. The "-
drawRect:", is that from the TrackingGraphView? It would also have
been interesting to see the millisecond timestamps.
How are you setting up your mouse tracking? Could it be that you're
re-setting tracking rectangles after removing the view from it's
superview? Or something like that... Can you NSLog the calls to "-
resetCursorRects"?
Try to set the IBOutlet to nil after removing the view from it's
superview. Or perhaps even better, set it to some a custom subclass
of NSObject and use message forwarding to track how / if it's
accessed. That might prove interesting.
You say that "[the scroll view] sets the graphics view to its
document view". That sounds a bit unusual. Usually, it would be
the window controller, or some other custom class, that did such a
thing. How is the scroll view locating the graphics view? Do you
have a custom scroll view subclass?
I have custom scroll class and add its document view as an outlet
to be linked up during awakeFromNib.
You can add your custom view as the document view of the scroll view
already in IB. No need to swap views in "-awakeFromNib". Just add a
"custom view", set it's class to your custom class, and then use the
"wrap in scroll view" command.
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden