summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbscreen.h
diff options
context:
space:
mode:
authorNils Jeisecke <nils.jeisecke@saltation.com>2022-06-20 12:42:06 +0200
committerLiang Qi <liang.qi@qt.io>2022-06-21 01:04:12 +0200
commit03e76ac23d3f9892c5853cab8760ca46c9117229 (patch)
tree1b7337604c9f050465e0d0030cb06a9280b2fec3 /src/plugins/platforms/xcb/qxcbscreen.h
parentfc2e40e88d44d457ec5ebd1cc235696f3f478be9 (diff)
xcb: fix missing initialization of m_cursor
Regression introduced in 9a4c98e55659b32db984612e6247ac193812a502: m_cursor is not initialized and never set when monitorInfo is not available in QXcbScreen::setMonitor. This seems to happen when running in VNC, e.g. on a Raspberry Pi. This usually results in crashing the application pretty soon. Using a unique_ptr solves both the initialization and a possible leak when setMonitor is called multiple times. [ChangeLog][Linux/XCB] Fixed crash when no monitorInfo is available (e.g. VNC). Fixes: QTBUG-104443 Pick-to: 6.3 6.4 Change-Id: If13493c177121a1994b5d00dfbd64f1da694df2e Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbscreen.h')
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index 12c13ef80e..5a844f944a 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -18,6 +18,8 @@
#include <QtGui/private/qedidparser_p.h>
+#include <memory>
+
QT_BEGIN_NAMESPACE
class QXcbConnection;
@@ -212,7 +214,7 @@ private:
QRect m_availableGeometry;
QColorSpace m_colorSpace;
Qt::ScreenOrientation m_orientation = Qt::PrimaryOrientation;
- QXcbCursor *m_cursor;
+ std::unique_ptr<QXcbCursor> m_cursor;
qreal m_refreshRate = 60.0;
QEdidParser m_edid;