From 3ea4f161cffb4d1374aa15839bf18b7b80502713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 2 Feb 2016 16:40:21 +0100 Subject: [PATCH] [wayland] Delete cursor theme when internal connection terminates Fixes a use-after-free reported by ASAN. --- abstract_backend.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/abstract_backend.cpp b/abstract_backend.cpp index b1b477882c..566dd78396 100644 --- a/abstract_backend.cpp +++ b/abstract_backend.cpp @@ -95,6 +95,12 @@ void AbstractBackend::updateCursorImage(Qt::CursorShape shape) // check whether we can create it if (waylandServer() && waylandServer()->internalShmPool()) { m_cursorTheme = new WaylandCursorTheme(waylandServer()->internalShmPool(), this); + connect(waylandServer(), &WaylandServer::terminatingInternalClientConnection, this, + [this] { + delete m_cursorTheme; + m_cursorTheme = nullptr; + } + ); } } if (!m_cursorTheme) {