summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2022-09-01 09:08:09 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-06 07:28:34 +0000
commitb0cadd5ed275dd64c19c15c0a09fe5d2383badf1 (patch)
tree103f372698471bd8dde4e74bcf54b7204af6f3ff /src
parent4d10022a8d9b0867e8f6230beb9b1794ae11a5c3 (diff)
Fix crash when setting override cursor on multiple clients
When a client disconnects, we need to disable its client cursor, otherwise there will be a dangling pointer stored in the pointer. In addition, we should reinstate the default cursor only when all clients have disconnected. Note: Patch provided in bug report. [ChangeLog][vnc] Fixed a crash when setting an override cursor on multiple clients. Fixes: QTBUG-105057 Change-Id: I0399087a924c05c8d0811b0ec0305b7857da5d3c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 9b6e79abbe66cc098ff8587c2f494716d920c4ea)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp5
-rw-r--r--src/plugins/platforms/vnc/qvncscreen.cpp5
2 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp
index d09c6789b7..60aae51100 100644
--- a/src/plugins/platforms/vnc/qvnc.cpp
+++ b/src/plugins/platforms/vnc/qvnc.cpp
@@ -635,11 +635,10 @@ void QVncServer::newConnection()
void QVncServer::discardClient(QVncClient *client)
{
clients.removeOne(client);
+ qvnc_screen->disableClientCursor(client);
client->deleteLater();
- if (clients.isEmpty()) {
- qvnc_screen->disableClientCursor(client);
+ if (clients.isEmpty())
qvnc_screen->setPowerState(QPlatformScreen::PowerStateOff);
- }
}
inline QImage QVncServer::screenImage() const
diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp
index eb8241138e..c67e5a0073 100644
--- a/src/plugins/platforms/vnc/qvncscreen.cpp
+++ b/src/plugins/platforms/vnc/qvncscreen.cpp
@@ -113,9 +113,10 @@ void QVncScreen::disableClientCursor(QVncClient *client)
if (clientCount == 0) {
delete clientCursor;
clientCursor = nullptr;
- }
- mCursor = new QFbCursor(this);
+ if (mCursor == nullptr)
+ mCursor = new QFbCursor(this);
+ }
#else
Q_UNUSED(client);
#endif