summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2021-03-18 11:24:10 +0100
committerLiang Qi <liang.qi@qt.io>2021-03-18 11:38:51 +0100
commit0e67fb41cfc4b4bfbaa7dc75f8ddebdf5a08e836 (patch)
tree02966260ed1cb094f097565530b62eac164c7198
parent64e2a26867a7ba66b3efbda625bf41e6e7efd794 (diff)
downloadqtx11extras-0e67fb41cfc4b4bfbaa7dc75f8ddebdf5a08e836.tar.gz
Fix crash due to bad cast to QXcbScreen
Fixes: QTBUG-91913 Change-Id: I498b8a18b7f47f94fd610f13797473951ea98f85 Reviewed-by: Liang Qi <liang.qi@qt.io>
-rw-r--r--dependencies.yaml2
-rw-r--r--src/x11extras/qx11info_x11.cpp5
-rw-r--r--tests/auto/qx11info/tst_qx11info.cpp12
3 files changed, 16 insertions, 3 deletions
diff --git a/dependencies.yaml b/dependencies.yaml
index 0fda16c..45dace5 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -1,4 +1,4 @@
dependencies:
../qtbase:
- ref: 130b2090147e0d28e35fd736fbefcd588c0014f6
+ ref: 57f752b30a0f452e9cc079b5a4ede6134719a769
required: true
diff --git a/src/x11extras/qx11info_x11.cpp b/src/x11extras/qx11info_x11.cpp
index ace0b6e..1ad1c75 100644
--- a/src/x11extras/qx11info_x11.cpp
+++ b/src/x11extras/qx11info_x11.cpp
@@ -50,6 +50,7 @@
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformwindow.h>
#include <qpa/qplatformscreen_p.h>
+#include <qpa/qplatformscreen.h>
#include <qscreen.h>
#include <qwindow.h>
#include <qguiapplication.h>
@@ -62,8 +63,8 @@ static QScreen *findScreenForVirtualDesktop(int virtualDesktopNumber)
{
const auto screens = QGuiApplication::screens();
for (QScreen *screen : screens) {
- auto *qxcbScreen = dynamic_cast<QNativeInterface::Private::QXcbScreen *>(screen);
- if (qxcbScreen->virtualDesktopNumber() == virtualDesktopNumber)
+ auto *qxcbScreen = dynamic_cast<QNativeInterface::Private::QXcbScreen *>(screen->handle());
+ if (qxcbScreen && qxcbScreen->virtualDesktopNumber() == virtualDesktopNumber)
return screen;
}
return nullptr;
diff --git a/tests/auto/qx11info/tst_qx11info.cpp b/tests/auto/qx11info/tst_qx11info.cpp
index b4207c1..36dd202 100644
--- a/tests/auto/qx11info/tst_qx11info.cpp
+++ b/tests/auto/qx11info/tst_qx11info.cpp
@@ -43,6 +43,7 @@ private slots:
void isPlatformX11();
void appTime();
void peeker();
+ void isCompositingManagerRunning();
};
void tst_QX11Info::staticFunctionsBeforeQApplication()
@@ -374,6 +375,17 @@ void tst_QX11Info::peeker()
QVERIFY(QTest::qWaitForWindowExposed(&test));
}
+void tst_QX11Info::isCompositingManagerRunning()
+{
+ int argc = 0;
+ QGuiApplication app(argc, 0);
+ const bool b = QX11Info::isCompositingManagerRunning();
+ Q_UNUSED(b);
+ const bool b2 = QX11Info::isCompositingManagerRunning(0);
+ Q_UNUSED(b2);
+ // just check that it didn't crash (QTBUG-91913)
+}
+
QTEST_APPLESS_MAIN(tst_QX11Info)
#include "tst_qx11info.moc"