From 2fe9f30512092cfb1928feaa9d3c56025c74f92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 17 Jan 2017 15:56:05 +0100 Subject: 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 --- src/plugins/platforms/cocoa/qcocoaintegration.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/cocoa/qcocoaintegration.h') 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 &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; -- cgit v1.2.3