diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-05-30 18:01:19 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-05-31 16:37:26 +0200 |
commit | ea1af6b7ed972910c6e125f9946f1f03f7b0de45 (patch) | |
tree | d602828d19c3973424975f724b96bb3397eaf479 /src | |
parent | 672a1d022c3aa36151c7b723b0c65e204980c202 (diff) |
Only consider QScreen virtual siblings that have been added
If a platform builds up a list of QPlatformScreens, and then adds
them incrementally, while at the same time implementing virtualSiblings
in QPlatformScreen to return the full list of screens, the virtual
sibling QScreens will contain nullptrs for each non-added screen.
It could be argued that this is the fault of the platform plugin,
since it's reporting a virtual sibling that it hasn't added yet,
but we can easily work around it in QScreen as well.
Fixes: QTBUG-113977
Pick-to: 6.5
Change-Id: I4b9472646a5cc10b6fd35c606e3ae15941da1587
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qscreen.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index abf8c4569c..d598e4fc54 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -360,8 +360,11 @@ QList<QScreen *> QScreen::virtualSiblings() const const QList<QPlatformScreen *> platformScreens = d->platformScreen->virtualSiblings(); QList<QScreen *> screens; screens.reserve(platformScreens.size()); - for (QPlatformScreen *platformScreen : platformScreens) - screens << platformScreen->screen(); + for (QPlatformScreen *platformScreen : platformScreens) { + // Only consider platform screens that have been added + if (auto *knownScreen = platformScreen->screen()) + screens << knownScreen; + } return screens; } |