Skip to content

Commit

Permalink
MacOS: another way to make sure windowDidResize does not access Fl_Wi…
Browse files Browse the repository at this point in the history
…ndow after [FLWindow close] message was sent

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12082 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Nov 6, 2016
1 parent 49a2e42 commit 214b3c3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Fl_cocoa.mm
Expand Up @@ -656,6 +656,13 @@ - (NSPoint)convertBaseToScreen:(NSPoint)aPoint;
@end

@implementation FLWindow
- (void)close
{
[super close];
// when a fullscreen window is closed, windowDidResize may be sent after the close message was sent
// and before the FLWindow receives the final dealloc message
w = NULL;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- (NSPoint)convertBaseToScreen:(NSPoint)aPoint
{
Expand Down Expand Up @@ -1317,9 +1324,9 @@ - (void)windowDidMove:(NSNotification *)notif
- (void)windowDidResize:(NSNotification *)notif
{
FLWindow *nsw = (FLWindow*)[notif object];
if (![nsw isVisible]) return;
fl_lock_function();
Fl_Window *window = [nsw getFl_Window];
if (!window) return;
fl_lock_function();
NSRect r; NSPoint pt2;
r = [[nsw contentView] frame];
pt2 = [nsw convertBaseToScreen:NSMakePoint(0, r.size.height)];
Expand Down

0 comments on commit 214b3c3

Please sign in to comment.