on xenial help sign in
fix crash on some dash tests now that it has two windows
commitf004c04b9eabd51b915c5addf069fd686e6a557f authorAlbert Astals Cid <albert.astals@canonical.com> dateMon 20 Jul 2015, 15:45 (11 years ago) parent02e5e01
1 file changed+8−2
tests/mocks/Unity/Application/MirSurfaceItem.cpp+8−2
tests/mocks/Unity/Application/MirSurfaceItem.cpp+8−2
@@ -54,8 +54,14 @@ MirSurfaceItem::MirSurfaceItem(const QString& name,
5454 QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
5555
5656 // The assumptions I make here really should hold.
57− QQuickView *quickView =
58− qobject_cast<QQuickView*>(QGuiApplication::topLevelWindows()[0]);
57+ const QWindowList windows = QGuiApplication::topLevelWindows();
58+ QQuickView *quickView = nullptr;
59+ Q_FOREACH(QWindow *w, windows) {
60+ quickView = qobject_cast<QQuickView*>(w);
61+ if (quickView) {
62+ break;
63+ }
64+ }
5965
6066 QString qmlComponentFilePath;
6167 if (!qmlFilePath.isEmpty()) {