diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-01-17 15:56:05 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-01-17 22:18:22 +0000 |
commit | 2fe9f30512092cfb1928feaa9d3c56025c74f92a (patch) | |
tree | 97794f14eb3c7a0ec1acf6b38a95f531b88cbaae /src/plugins/platforms/cocoa/qcocoawindow.mm | |
parent | 04a74c362f786e6300deb912c0ad40996f8b3bc3 (diff) |
macOS: Keep reference to NSScreen via index instead of pointer
Manual revert of 73e68a9c0f8b6, which was flawed. macOS can, and will,
dealloc and realloc NSScreen instances for a given screen index, for
example when deallocing an NSWindow, which has the screen as an
auxiliary resource. This is also documented for +[NSScreen screens],
which states that "The array should not be cached".
Task-number: QTBUG-58128
Change-Id: I926513a26cb7af52acd7fc5ee9380ef29ede65e6
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index ea06bfca88..43817febd4 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1685,7 +1685,7 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBeChildNSWindow, bool sh // Use NSPanel for popup-type windows. (Popup, Tool, ToolTip, SplashScreen) // and dialogs if (shouldBePanel) { - QNSPanel *panel = [[QNSPanel alloc] initWithContentRect:frame screen:cocoaScreen->nsScreen() + QNSPanel *panel = [[QNSPanel alloc] initWithContentRect:frame screen:cocoaScreen->nativeScreen() styleMask: styleMask qPlatformWindow:this]; if ((type & Qt::Popup) == Qt::Popup) @@ -1704,7 +1704,7 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBeChildNSWindow, bool sh createdWindow = panel; } else { - createdWindow = [[QNSWindow alloc] initWithContentRect:frame screen:cocoaScreen->nsScreen() + createdWindow = [[QNSWindow alloc] initWithContentRect:frame screen:cocoaScreen->nativeScreen() styleMask: styleMask qPlatformWindow:this]; } |