Thanks for pointing that one out, but it wasn't the cause for my
problem.
As for retaining the delegate, originally I wasn't, I just took the
advice from Roland, but it doesn't break if I don't have it there :D
On 07/03/2009, at 5:27 PM, Graham Cox wrote:
On 07/03/2009, at 5:18 PM, Aaron Wallis wrote:
[delegate release];
delegate = tDelegate;
[delegate retain];
What if tDelegate == delegate?
You release delegate, which *may* dealloc it. Then you assign
tDelegate to it. If tDelegate == delegate (not uncommon that objects
are the same) then you've assigned a stale pointer. The following -
retain is too late.
The correct pattern is always "retain before release", i.e.:
[tDelegate retain];
[delegate release];
delegate = tDelegate;
Not sure if it has a bearing on your problem, but make sure the
obvious bugs are fixed first.
But in any case, you shouldn't be retaining your delegate. See the
doc link I posted a second ago.
--Graham
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com