macOS: Guard QCocoaWindow access when handling application activation change
The platform window may in some cases be gone, without its NSWindow yet being deallocated, and if we receive an application activation event at this point we would try to dereference a null-pointer. Fixes: QTBUG-119219 Pick-to: 6.5 6.2 Change-Id: I72bb2482059d1a256e448705b132e4a8f22ec297 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 778acfe122baf5a65c1001e78050f333106a840d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d1e7e4b02c
commit
7e34539e75
@ -107,9 +107,10 @@ NSWindow<QNSWindowProtocol> *qnswindow_cast(NSWindow *window)
|
||||
continue;
|
||||
|
||||
if ([window conformsToProtocol:@protocol(QNSWindowProtocol)]) {
|
||||
QCocoaWindow *cocoaWindow = static_cast<QCocoaNSWindow *>(window).platformWindow;
|
||||
window.level = notification.name == NSApplicationWillResignActiveNotification ?
|
||||
NSNormalWindowLevel : cocoaWindow->windowLevel(cocoaWindow->window()->flags());
|
||||
if (QCocoaWindow *cocoaWindow = static_cast<QCocoaNSWindow *>(window).platformWindow) {
|
||||
window.level = notification.name == NSApplicationWillResignActiveNotification ?
|
||||
NSNormalWindowLevel : cocoaWindow->windowLevel(cocoaWindow->window()->flags());
|
||||
}
|
||||
}
|
||||
|
||||
// The documentation says that "when a window enters a new level, it’s ordered
|
||||
|
Loading…
x
Reference in New Issue
Block a user