From 38b8dfaaea55d20f7209199638dd44fe0161add2 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:06:10 +0100 Subject: Remove [FLViewLayer dealloc] method. The Apple doc recommends not to release resources in an object's dealloc method. The job is now done in the [FLWindow close] method. --- src/Fl_cocoa.mm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 34fb7ba44..5bfeb390d 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -597,7 +597,6 @@ void Fl_Cocoa_Screen_Driver::breakMacEventLoop() - (void)prepare_bitmap_for_layer; - (void)viewFrameDidChange; - (BOOL)wantsLayer; -- (void)dealloc; - (BOOL)did_view_resolution_change; - (void)drawRect:(NSRect)rect; @end @@ -610,6 +609,13 @@ void Fl_Cocoa_Screen_Driver::breakMacEventLoop() // 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_8 + if ([[self contentView] isMemberOfClass:[FLViewLayer class]]) { + FLViewLayer *view = (FLViewLayer*)[self contentView]; + CGContextRelease(view->layer_data); + view->layer_data = NULL; + } +#endif } #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 - (NSPoint)convertBaseToScreen:(NSPoint)aPoint @@ -2302,10 +2308,6 @@ static FLTextInputContext* fltextinputcontext_instance = nil; CGContextRelease(layer_data); layer_data = NULL; } --(void)dealloc { - CGContextRelease(layer_data); - [super dealloc]; -} - (void)drawRect:(NSRect)rect {} // necessary under 10.14.2 to support gl_start() @end #endif //>= MAC_OS_X_VERSION_10_8 -- cgit v1.2.3