[aseprite] 141/250: Fix crash on resize on Skia/OSX port

Tobias Hansen thansen at moszumanska.debian.org
Sun Dec 20 15:27:22 UTC 2015


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 6e5271848c24f84294eb711088f7af719f9a6719
Author: David Capello <davidcapello at gmail.com>
Date:   Wed Oct 7 10:43:53 2015 -0300

    Fix crash on resize on Skia/OSX port
    
    Keep NSWindowDelegate reference alive in OSXWindow
---
 src/she/osx/window.mm | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/she/osx/window.mm b/src/she/osx/window.mm
index 5b1e1d8..379157b 100644
--- a/src/she/osx/window.mm
+++ b/src/she/osx/window.mm
@@ -19,12 +19,11 @@
   she::EventQueue* queue;
   OSXWindow* window;
 }
+- (OSXWindowDelegate*)initWithWindow:(OSXWindow*)window;
 - (BOOL)windowShouldClose:(id)sender;
 - (void)windowWillClose:(NSNotification *)notification;
 - (void)windowDidResize:(NSNotification*)notification;
 - (void)windowDidMiniaturize:(NSNotification*)notification;
-- (void)setEventQueue:(she::EventQueue*)aQueue;
-- (void)setOSXWindow:(OSXWindow*)aWindow;
 @end
 
 @interface OSXView : NSView
@@ -33,6 +32,13 @@
 
 @implementation OSXWindowDelegate
 
+- (OSXWindowDelegate*)initWithWindow:(OSXWindow*)aWindow
+{
+  window = aWindow;
+  queue = she::instance()->eventQueue();
+  return self;
+}
+
 - (BOOL)windowShouldClose:(id)sender
 {
   [window closeDelegate]->notifyClose();
@@ -51,16 +57,6 @@
 {
 }
 
-- (void)setEventQueue:(she::EventQueue*)aQueue
-{
-  queue = aQueue;
-}
-
-- (void)setOSXWindow:(OSXWindow*)aWindow
-{
-  window = aWindow;
-}
-
 @end
 
 @implementation OSXView
@@ -81,10 +77,6 @@
   clientSize.w = restoredSize.w = rect.size.width;
   clientSize.h = restoredSize.h = rect.size.height;
 
-  OSXWindowDelegate* windowDelegate = [[OSXWindowDelegate new] autorelease];
-  [windowDelegate setEventQueue:she::instance()->eventQueue()];
-  [windowDelegate setOSXWindow:self];
-
   OSXView* view = [[[OSXView alloc] initWithFrame:rect] autorelease];
   [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
 
@@ -94,7 +86,7 @@
                      backing:NSBackingStoreBuffered
                        defer:NO];
 
-  [self setDelegate:windowDelegate];
+  [self setDelegate:[[OSXWindowDelegate alloc] initWithWindow:self]];
   [self setContentView:view];
   [self center];
   return self;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list