summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-02-08 16:53:39 +0100
committerJohan Helsing <johan.helsing@qt.io>2018-02-21 15:25:10 +0000
commit13aaed5806c3a5ef90a11757e7aeb92360c71605 (patch)
tree33a7c6ac161639d62fdab1f40cda472a66a48353
parent01deb0260a9f3ef683dc6120e62243ed18fcb1aa (diff)
Fix crash when connecting a new screen
In QWaylandWindow::virtualSiblings, don't include screens that have not been added yet. I.e. QWaylandScreens for which QPlatformIntegration::screenAdded has not yet been called. The cherry-picked version does not include the tests from the original patch. Task-number: QTBUG-62044 Change-Id: I623fbf8799d21c6b9293e7120ded301277639cc6 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Aleix Pol Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit fd9fec4fc7f43fb939e8e5a946c7858390bbd9d3)
-rw-r--r--src/client/qwaylandscreen.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp
index 334e0ec46..1834bcc45 100644
--- a/src/client/qwaylandscreen.cpp
+++ b/src/client/qwaylandscreen.cpp
@@ -128,8 +128,10 @@ QList<QPlatformScreen *> QWaylandScreen::virtualSiblings() const
QList<QPlatformScreen *> list;
const QList<QWaylandScreen*> screens = mWaylandDisplay->screens();
list.reserve(screens.count());
- foreach (QWaylandScreen *screen, screens)
- list << screen;
+ for (QWaylandScreen *screen : qAsConst(screens)) {
+ if (screen->screen())
+ list << screen;
+ }
return list;
}