mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 03:44:16 +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;
|
she::EventQueue* queue;
|
||||||
OSXWindow* window;
|
OSXWindow* window;
|
||||||
}
|
}
|
||||||
|
- (OSXWindowDelegate*)initWithWindow:(OSXWindow*)window;
|
||||||
- (BOOL)windowShouldClose:(id)sender;
|
- (BOOL)windowShouldClose:(id)sender;
|
||||||
- (void)windowWillClose:(NSNotification *)notification;
|
- (void)windowWillClose:(NSNotification *)notification;
|
||||||
- (void)windowDidResize:(NSNotification*)notification;
|
- (void)windowDidResize:(NSNotification*)notification;
|
||||||
- (void)windowDidMiniaturize:(NSNotification*)notification;
|
- (void)windowDidMiniaturize:(NSNotification*)notification;
|
||||||
- (void)setEventQueue:(she::EventQueue*)aQueue;
|
|
||||||
- (void)setOSXWindow:(OSXWindow*)aWindow;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface OSXView : NSView
|
@interface OSXView : NSView
|
||||||
@ -33,6 +32,13 @@
|
|||||||
|
|
||||||
@implementation OSXWindowDelegate
|
@implementation OSXWindowDelegate
|
||||||
|
|
||||||
|
- (OSXWindowDelegate*)initWithWindow:(OSXWindow*)aWindow
|
||||||
|
{
|
||||||
|
window = aWindow;
|
||||||
|
queue = she::instance()->eventQueue();
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)windowShouldClose:(id)sender
|
- (BOOL)windowShouldClose:(id)sender
|
||||||
{
|
{
|
||||||
[window closeDelegate]->notifyClose();
|
[window closeDelegate]->notifyClose();
|
||||||
@ -51,16 +57,6 @@
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setEventQueue:(she::EventQueue*)aQueue
|
|
||||||
{
|
|
||||||
queue = aQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setOSXWindow:(OSXWindow*)aWindow
|
|
||||||
{
|
|
||||||
window = aWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation OSXView
|
@implementation OSXView
|
||||||
@ -81,10 +77,6 @@
|
|||||||
clientSize.w = restoredSize.w = rect.size.width;
|
clientSize.w = restoredSize.w = rect.size.width;
|
||||||
clientSize.h = restoredSize.h = rect.size.height;
|
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];
|
OSXView* view = [[[OSXView alloc] initWithFrame:rect] autorelease];
|
||||||
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||||
|
|
||||||
@ -94,7 +86,7 @@
|
|||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:NO];
|
defer:NO];
|
||||||
|
|
||||||
[self setDelegate:windowDelegate];
|
[self setDelegate:[[OSXWindowDelegate alloc] initWithWindow:self]];
|
||||||
[self setContentView:view];
|
[self setContentView:view];
|
||||||
[self center];
|
[self center];
|
||||||
return self;
|
return self;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user