summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaintegration.mm
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-03-01 13:19:24 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-02 14:45:23 +0100
commit62a654cc902197cc99326879076ba53b6509dc67 (patch)
tree232a0e0fdebf2b5c956f80e432e8870c4d545fdc /src/plugins/platforms/cocoa/qcocoaintegration.mm
parent53229ec8f79c4895e0476d1f3fb950f0427ba427 (diff)
Fix QApplication autotest crash when running on multiple screens
Screens need to be destroyed in reverse order to ensure the primary screen stays valid when other screens are destroyed. Task-number: QTBUG-24300 Change-Id: I9d9d710aa67ec045baa8bf292833ffe7d9eea935 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaintegration.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index fb8e487029..626a7fe0f9 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -134,6 +134,7 @@ QCocoaIntegration::QCocoaIntegration()
NSArray *screens = [NSScreen screens];
for (uint i = 0; i < [screens count]; i++) {
QCocoaScreen *screen = new QCocoaScreen(i);
+ mScreens.append(screen);
screenAdded(screen);
}
@@ -142,6 +143,11 @@ QCocoaIntegration::QCocoaIntegration()
QCocoaIntegration::~QCocoaIntegration()
{
[[NSApplication sharedApplication] setDelegate: 0];
+
+ // Delete screens in reverse order to avoid crash in case of multiple screens
+ while (!mScreens.isEmpty()) {
+ delete mScreens.takeLast();
+ }
}
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const