Forum breadcrumbs - You are here:WeLoveGod RallysPublic Forums: fbcocoaCrash when window is closed but O …
You need to log in to create posts and topics.
Crash when window is closed but OK when on normal Quit.
1,678 Posts
#1 · September 30, 2012, 10:09 pm
Quote from Forum Archives on September 30, 2012, 10:09 pmPosted by: fblistserve <fblistserve@...>
My main app delegate contains:-(void)doQuitHouseKeeping{// save selected tabview pane in preferencesNSUserDefaults *ud = [NSUserDefaults standardUserDefaults];[ud setInteger: [self getPaneLastUsed] forKey:kPaneLastUsedKey];// <<<<<<<<<<<< crashes here on window close[ud synchronize];}// app delegate callbacks-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication{return YES;}- (void)applicationWillTerminate:(NSNotification *)aNotif{[self doQuitHouseKeeping];}On a window close the [self getPaneLastUsed] crashes. If the app is Quit no crash and all works. AFAIK, umy use of these two delegate callbacks is correct. It seems the tab object is gone at the point doQuitHouseKeeping executes which explains the crash trying to call a method on it. Suggestions welcome for what delegates to use here. My fallback solution is just write the pref each time the user changes tabs but I don’t like it.Brian S.
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Posted by: fblistserve <fblistserve@...>
My main app delegate contains:
-(void)doQuitHouseKeeping
{
// save selected tabview pane in preferences
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[ud setInteger: [self getPaneLastUsed] forKey:kPaneLastUsedKey];// <<<<<<<<<<<< crashes here on window close
[ud synchronize];
}
// app delegate callbacks
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication
{
return YES;
}
- (void)applicationWillTerminate:(NSNotification *)aNotif
{
[self doQuitHouseKeeping];
}
On a window close the [self getPaneLastUsed] crashes. If the app is Quit no crash and all works. AFAIK, umy use of these two delegate callbacks is correct. It seems the tab object is gone at the point doQuitHouseKeeping executes which explains the crash trying to call a method on it. Suggestions welcome for what delegates to use here. My fallback solution is just write the pref each time the user changes tabs but I don’t like it.
Brian S.
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Click for thumbs down.0Click for thumbs up.0