override applicationShouldTerminate so we can cleanup when we quit

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/636723002
This commit is contained in:
reed 2014-10-07 03:59:34 -07:00 committed by Commit bot
parent 5397725ca7
commit 3fc02f1720
3 changed files with 16 additions and 0 deletions

View File

@ -21,4 +21,7 @@
@property (assign) IBOutlet SkOptionsTableView* fOptions;
- (IBAction)toiPadSize:(id)sender;
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
@end

View File

@ -1,4 +1,7 @@
#import "SampleAppDelegate.h"
#include "SkApplication.h"
@implementation SampleAppDelegate
@synthesize fWindow, fView, fOptions;
@ -13,4 +16,10 @@
NSRect frame = NSMakeRect(fWindow.frame.origin.x, fWindow.frame.origin.y, 768, 1024);
[fWindow setFrame:frame display:YES animate:YES];
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
application_term();
return NSTerminateNow;
}
@end

View File

@ -14,7 +14,11 @@ int main(int argc, char *argv[]) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
application_init();
int retVal = NSApplicationMain(argc, (const char **)argv);
#if 0
// we don't expect NSApplicationMain to return. See our applicationShouldTerminate handler.
application_term();
[pool release];
#endif
return retVal;
}