mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Fix crash on resize on Skia/OSX port
Keep NSWindowDelegate reference alive in OSXWindow
This commit is contained in:
parent
e3f0688945
commit
6e5271848c
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user