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/qcocoaintegration.h | |
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/qcocoaintegration.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index 5cf8e7d237..a3c375881d 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QCocoaScreen : public QPlatformScreen { public: - QCocoaScreen(NSScreen *screen); + QCocoaScreen(int screenIndex); ~QCocoaScreen(); // ---------------------------------------------------- @@ -84,7 +84,7 @@ public: // ---------------------------------------------------- // Additional methods void setVirtualSiblings(const QList<QPlatformScreen *> &siblings) { m_siblings = siblings; } - NSScreen *nsScreen() const; + NSScreen *nativeScreen() const; void updateGeometry(); QPointF mapToNative(const QPointF &pos) const { return flipCoordinate(pos); } @@ -97,7 +97,7 @@ private: QRectF flipCoordinate(const QRectF &rect) const; public: - NSScreen *m_nsScreen; + int m_screenIndex; QRect m_geometry; QRect m_availableGeometry; QDpi m_logicalDpi; |