diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-08-27 12:43:16 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-17 17:10:05 +0200 |
commit | 8f46cb3ade5a57506afcd1589e489bbcf38ca7f9 (patch) | |
tree | 44013dc654d5f4e5ab5ee2ef7497478ef2a9551d /src | |
parent | 5ee6c2490123ad9d742d007e68bd5a3dab2b3dfe (diff) |
Keep Cocoa screen list in sync on screen connect.
The backtrace in QTBUG-33012 indicates that the
screen list is getting out of sync on plugging/unplugging
an external monitor. This happens on 10.9 only.
Check if we are about to out of bounds access the
screen list; call updateScreens() which will add the
new screen.
Task-number: QTBUG-33012
Change-Id: Id1acc3baca9e60e7f2a83188d66cdf9d322a582c
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.mm | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index 7831888da1..8620ef4267 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -125,7 +125,7 @@ public: QList<int> possibleKeys(const QKeyEvent *event) const; void updateScreens(); - QCocoaScreen *screenAtIndex(int index) const { return mScreens.at(index); } + QCocoaScreen *screenAtIndex(int index); private: diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index fad743439e..5f0ad24241 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -343,6 +343,14 @@ void QCocoaIntegration::updateScreens() screen->setVirtualSiblings(siblings); } +QCocoaScreen *QCocoaIntegration::screenAtIndex(int index) +{ + if (index >= mScreens.count()) + updateScreens(); + + return mScreens.at(index); +} + bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const { switch (cap) { |