Re: Best data source for table view in document window
Re: Best data source for table view in document window
- Subject: Re: Best data source for table view in document window
- From: Jerry Krinock <email@hidden>
- Date: Thu, 06 Sep 2012 11:36:37 -0700
On 2012 Sep 05, at 21:13, Martin Hewitson <email@hidden> wrote:
> I already had a -cleanUp method being called from -windowWillClose: within the NSDocument
I just checked my code again and found that I am already using -windowWillClose: as suggested by Graham, for the stuff in the window, and a quick test shows that -windowWillClose: is invoked earlier than my other triggers. But I'm still using my other triggers because sometimes my document opens with no windows, and there may be other programmatic ways that closing can be initiated.
> (NSPersistentDocument, actually)
Oh, that's even more fun! But apparently not related to the crash you're reporting.
> I have in the back of my mind a memory about timers retaining their target, but I think I handle that in the accepted way by calling -invalidate on the timer.
Yes, it looks OK to me.
>
> Maybe I shouldn't care about the order in which my dealloc messages appear?
Yes, because you've already removed all vulnerable references in -windowWillClose:
> With this new scheme described above, I've been able to open and close a document many 10's of times without a crash. But somehow I have a nagging doubt that I've really nailed this down.
Use the software equivalent of Accelerated Life Testing. If your app is scriptable, write a script to open, stress, and close a document, and let it loop for several days. If not scriptable, either make it scriptable (which may have unforeseen future re-use), or patch in a temporary bonehead loop.
_______________________________________________
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