Re: Leopard and Tiger Notification Differences?
Re: Leopard and Tiger Notification Differences?
- Subject: Re: Leopard and Tiger Notification Differences?
- From: John Nairn <email@hidden>
- Date: Fri, 8 Feb 2008 15:59:47 -0800
On Feb 8, 2008, at 2:47 PM, Mark Piccirelli wrote:
On Feb 8, 2008, at 1:58 PM, John Nairn wrote:
I have run into several crashes in Leopard that never happened in
Tiger. In all cases, the problem has been a notification sent to a
deallocated object. I have been able to fix them, but why do these
bugs keep happening in Leopard. Either Tiger was smarter (i.e., not
sending messages to deallocated objects) or Leopard is handling
notifications differently. I can document a difference now and
wonder how is one supposed to know what to expect?
There were some changes in NSWindowController between Tiger and
Leopard. See the "New Behavior in NSWindowController at Window
Closing Time" and "Bug Fixes in -[NSWindowController dealloc]"
sections in the Leopard AppKit release notes at http://developer.apple.com/releasenotes/Cocoa/AppKit.html
. In a couple of places it's not releasing instead of autoreleasing.
Hopefully that explains what you're seeing.
I had my previous post in slightly the wrong order, but the correct
order is explained by Apple's release notes which say:
"the window controller itself is now released instead of autoreleased"
In Leopard, closing my window controller and sending a message goes as
follows:
1. window controller is deallocated (because of the new release rule)
2. The scheduled method is invoked
3. The interface objects are released (because they are still
autoreleased)
In Tiger this went (corrected order from my previous post)
1. The scheduled method is invoked
2. The window controller is deallocated (because it was autoreleased
in Tiger)
3. The interface objects are released (autoreleased)
My code was sensitive to some methods being called in the middle of
releasing the window, its controller, and its objects. In Tiger this
releasing was always together (sounds like all were autoreleased), but
in Leopard the controller is released while nib objects are
autoreleased.
---------------
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden