override applicationShouldTerminate so we can cleanup when we quit
authorreed <reed@chromium.org>
Tue, 7 Oct 2014 10:59:34 +0000 (03:59 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 7 Oct 2014 10:59:34 +0000 (03:59 -0700)
BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/636723002

src/views/mac/SampleAppDelegate.h
src/views/mac/SampleAppDelegate.mm
src/views/mac/skia_mac.mm

index 8f2bead7bd6c265eba46f6d9042f4f72c09c28e2..e22ad9d6ea67c840d79edb47a6574bd842af16b1 100644 (file)
@@ -21,4 +21,7 @@
 @property (assign) IBOutlet SkOptionsTableView* fOptions;
 
 - (IBAction)toiPadSize:(id)sender;
+
+- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
+
 @end
index 91dcada8880d44846e3bb88004fbe0f1d0d90371..8211ad9c48c38cbdc8979f7a5e0b1bdb80d0a93e 100644 (file)
@@ -1,4 +1,7 @@
 #import "SampleAppDelegate.h"
+
+#include "SkApplication.h"
+
 @implementation SampleAppDelegate
 @synthesize fWindow, fView, fOptions;
 
     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
index e3c31c40f6084ca555c7419f2e98aa8efe5394c0..393e6d81414a7499763b2946dd747f361f57d01e 100644 (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;
 }