diff --git a/src/plugins/platforms/cocoa/qnswindow.h b/src/plugins/platforms/cocoa/qnswindow.h index 62e2d93c603..b13b6d42a9e 100644 --- a/src/plugins/platforms/cocoa/qnswindow.h +++ b/src/plugins/platforms/cocoa/qnswindow.h @@ -83,7 +83,6 @@ typedef NSWindow QCocoaNSWindow; - (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow; - (void)handleWindowEvent:(NSEvent *)theEvent; -- (void)clearWindow; - (void)detachFromPlatformWindow; @end diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index 3bb2c2eb3d1..96c03147697 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -114,14 +114,7 @@ static bool isMouseEvent(NSEvent *ev) - (void)handleWindowEvent:(NSEvent *)theEvent { - // The call to -[NSWindow sendEvent] may result in the window being deleted - // (e.g., when closing the window by pressing the title bar close button). - [self retain]; [self.window superSendEvent:theEvent]; - bool windowStillAlive = self.window != nil; // We need to read before releasing - [self release]; - if (!windowStillAlive) - return; if (!self.platformWindow) return; // Platform window went away while processing event @@ -143,11 +136,6 @@ static bool isMouseEvent(NSEvent *ev) self.window.delegate = nil; } -- (void)clearWindow -{ - _window = nil; -} - - (void)dealloc { _window = nil; @@ -226,7 +214,6 @@ static const bool kNoDefer = NO; - (void)dealloc { - [_helper clearWindow]; [_helper release]; _helper = nil; [super dealloc]; @@ -364,7 +351,6 @@ static const bool kNoDefer = NO; - (void)dealloc { - [_helper clearWindow]; [_helper release]; _helper = nil; [super dealloc];