delaying document close
delaying document close
- Subject: delaying document close
- From: Martin Hewitson <email@hidden>
- Date: Sat, 08 Dec 2012 08:28:01 +0100
Dear list,
I have a document based app which has a number of per-document background tasks fired off timers. After moving from GC to ARC the app was suffering from crashes when closing documents due to the referencing of deallocated objects. So I've gone through the whole app and implemented -tearDown methods which I then call from my document subclass -windowWillClose:. In many of the -tearDown methods I deactivate the relevant timers by doing, for example,
- (void) stopMetadataTimer
{
if (self.metadataTimer) {
[self.aQueue cancelAllOperations];
self.aQueue = nil;
[self.metadataTimer invalidate];
self.metadataTimer = nil;
}
}
But I still get occasional crashes so I was wondering if there is a way to delay the closing of the document by one or two seconds to allow all the background processes which may be executing to finish before pulling the rug out from beneath their feet.
Best wishes,
Martin
_______________________________________________
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