aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-10-07 06:42:09 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-07 06:42:09 -0700
commitd3ce6b44e582c1a4c73a90b4314a387db8624ca2 (patch)
tree371ee3a3a899b676638e6d009725b05b93373e3d
parentebfce4149e70b563cff3d889515250db3a729ad1 (diff)
explicitly delete our c++ window on quit
BUG=skia: TBR= NOTRY=True Review URL: https://codereview.chromium.org/633923002
-rw-r--r--src/views/mac/SampleAppDelegate.mm1
-rw-r--r--src/views/mac/SkNSView.h3
-rw-r--r--src/views/mac/SkNSView.mm7
-rw-r--r--src/views/mac/SkSampleNSView.mm5
4 files changed, 10 insertions, 6 deletions
diff --git a/src/views/mac/SampleAppDelegate.mm b/src/views/mac/SampleAppDelegate.mm
index 8211ad9c48..2d45034897 100644
--- a/src/views/mac/SampleAppDelegate.mm
+++ b/src/views/mac/SampleAppDelegate.mm
@@ -18,6 +18,7 @@
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
+ [fView freeNativeWind];
application_term();
return NSTerminateNow;
}
diff --git a/src/views/mac/SkNSView.h b/src/views/mac/SkNSView.h
index dfc81ea5bd..9cc29498f6 100644
--- a/src/views/mac/SkNSView.h
+++ b/src/views/mac/SkNSView.h
@@ -49,4 +49,7 @@ class SkEvent;
- (bool)attach:(SkOSWindow::SkBackEndTypes)attachType withMSAASampleCount:(int) sampleCount andGetInfo:(SkOSWindow::AttachmentInfo*) info;
- (void)detach;
- (void)present;
+
+- (void)freeNativeWind;
+
@end
diff --git a/src/views/mac/SkNSView.mm b/src/views/mac/SkNSView.mm
index 67141679db..e1e03d670b 100644
--- a/src/views/mac/SkNSView.mm
+++ b/src/views/mac/SkNSView.mm
@@ -118,12 +118,17 @@ SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build);
}
- (void)dealloc {
- delete fWind;
+ [self freeNativeWind];
self.fGLContext = nil;
self.fTitle = nil;
[super dealloc];
}
+- (void)freeNativeWind {
+ delete fWind;
+ fWind = nil;
+}
+
////////////////////////////////////////////////////////////////////////////////
- (void)drawSkia {
diff --git a/src/views/mac/SkSampleNSView.mm b/src/views/mac/SkSampleNSView.mm
index ce5f8aab0a..7c0fc5907b 100644
--- a/src/views/mac/SkSampleNSView.mm
+++ b/src/views/mac/SkSampleNSView.mm
@@ -18,11 +18,6 @@
return self;
}
-- (void)dealloc {
- delete fWind;
- [super dealloc];
-}
-
- (void)swipeWithEvent:(NSEvent *)event {
CGFloat x = [event deltaX];
if (x < 0)