macOS: Remove workaround for crash when closing window from title bar
The platform window is now protected by a QPointer, so we don't need to juggle the NSWindow retain count. Task-number: QTBUG-37287 Change-Id: Id55ea311f0793370e248aa58cc8e383b574fbb40 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
d95414171f
commit
92cfa3dfa6
@ -83,7 +83,6 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
|
|||||||
|
|
||||||
- (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow;
|
- (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow;
|
||||||
- (void)handleWindowEvent:(NSEvent *)theEvent;
|
- (void)handleWindowEvent:(NSEvent *)theEvent;
|
||||||
- (void)clearWindow;
|
|
||||||
- (void)detachFromPlatformWindow;
|
- (void)detachFromPlatformWindow;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -114,14 +114,7 @@ static bool isMouseEvent(NSEvent *ev)
|
|||||||
|
|
||||||
- (void)handleWindowEvent:(NSEvent *)theEvent
|
- (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];
|
[self.window superSendEvent:theEvent];
|
||||||
bool windowStillAlive = self.window != nil; // We need to read before releasing
|
|
||||||
[self release];
|
|
||||||
if (!windowStillAlive)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!self.platformWindow)
|
if (!self.platformWindow)
|
||||||
return; // Platform window went away while processing event
|
return; // Platform window went away while processing event
|
||||||
@ -143,11 +136,6 @@ static bool isMouseEvent(NSEvent *ev)
|
|||||||
self.window.delegate = nil;
|
self.window.delegate = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)clearWindow
|
|
||||||
{
|
|
||||||
_window = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
_window = nil;
|
_window = nil;
|
||||||
@ -226,7 +214,6 @@ static const bool kNoDefer = NO;
|
|||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[_helper clearWindow];
|
|
||||||
[_helper release];
|
[_helper release];
|
||||||
_helper = nil;
|
_helper = nil;
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
@ -364,7 +351,6 @@ static const bool kNoDefer = NO;
|
|||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[_helper clearWindow];
|
|
||||||
[_helper release];
|
[_helper release];
|
||||||
_helper = nil;
|
_helper = nil;
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
Loading…
Reference in New Issue
Block a user