Re: Removed view still getting events (Solved?)
Re: Removed view still getting events (Solved?)
- Subject: Re: Removed view still getting events (Solved?)
- From: John Nairn <email@hidden>
- Date: Fri, 29 Sep 2006 13:58:20 -0700
I think I solved the problem. The view that was getting removed had
registered itself to watch for NSWindowDidResizeNotification's. Even
though tthat view stopped observing when it was deallocated, this
notification was occurring during my windowDidLoad process of
swapping out views (prior to its deallocation) and something in the
called method did not like being called in this view (I am not sure
exactly what - but it set up something in the window that caused a
crash sometime down the road when the mouse entered the old view -
see below).
By telling the old view to stop observing before swapping out views
(and therefore before any NSWindowDidResizeNotification's), the
problem has gone away.
Thanks for all the input. The comment to think about tracking rects
was the key to the final answer. Now I can enjoy the weekend.
-----------
Here is what got called by NSWindowDidResizeNotification. If it was
called just prior to swapping out the trackingRect had never been
defined. Perhaps the addTrackingRect with the soon-to-be-removed as
owner was the problem.
- (void)fixTrackingRect:(NSNotification *)notify
{
if([notify object] == [self window])
{ [self removeTrackingRect:trackingRect];
trackingRect=[self addTrackingRect:[self visibleRect]
owner:self userData:0 assumeInside:NO];
}
}
---------------
John Nairn (1-541-737-4265, FAX:1-541-737-3385)
Professor and Richardson Chair
Web Page: http://woodscience.oregonstate.edu/faculty/Nairn
FEA/MPM Web Page: http://oregonstate.edu/~nairnj
_______________________________________________
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