diff options
author | Sergio Martins <sergio.martins.qnx@kdab.com> | 2013-01-31 19:08:12 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-05 11:55:47 +0100 |
commit | 9d7e63e37033741175baa38dc6b9faeebf7d2aa1 (patch) | |
tree | bf466432db14b210784b202cd785e61cb1d30df7 /src | |
parent | 7cc3a3adf2952b94616785472f3541f97c4ee012 (diff) |
QNX: Fix one more code path that led to having no QScreens.
Qt dereferences QGuiApplication::primaryScreen() inside,
for example, QColormapPrivate::initialize().
libscreen always returns at least one display, even it it's
not connected, so lets not ignore it if it's primary.
Change-Id: I2f14a187c979ca0c7ad39149ceb0b2b7e61e9ba6
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/qnx/qqnxintegration.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index bff4dbdc2a..d7370998d5 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -446,6 +446,11 @@ void QQnxIntegration::createDisplays() qFatal("QQnxIntegration: failed to query display count, errno=%d", errno); } + if (displayCount < 1) { + // Never happens, even if there's no display, libscreen returns 1 + qFatal("QQnxIntegration: displayCount=%d", displayCount); + } + // Get all displays errno = 0; screen_display_t *displays = (screen_display_t *)alloca(sizeof(screen_display_t) * displayCount); @@ -454,7 +459,11 @@ void QQnxIntegration::createDisplays() qFatal("QQnxIntegration: failed to query displays, errno=%d", errno); } - for (int i=0; i<displayCount; i++) { + // If it's primary, we create a QScreen for it even if it's not attached + // since Qt will dereference QGuiApplication::primaryScreen() + createDisplay(displays[0], /*isPrimary=*/true); + + for (int i=1; i<displayCount; i++) { int isAttached = 0; result = screen_get_display_property_iv(displays[i], SCREEN_PROPERTY_ATTACHED, &isAttached); if (result != 0) { @@ -468,7 +477,7 @@ void QQnxIntegration::createDisplays() } qIntegrationDebug() << Q_FUNC_INFO << "Creating screen for display" << i; - createDisplay(displays[i], i==0); + createDisplay(displays[i], /*isPrimary=*/false); } // of displays iteration } |