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>
This commit is contained in:
Morten Johan Sørvig 2013-08-27 12:43:16 +02:00 committed by The Qt Project
parent 5ee6c24901
commit 8f46cb3ade
2 changed files with 9 additions and 1 deletions

View File

@ -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:

View File

@ -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) {