[wayland] Delete cursor theme when internal connection terminates

Fixes a use-after-free reported by ASAN.
This commit is contained in:
Martin Gräßlin 2016-02-02 16:40:21 +01:00
parent a0cc3aac63
commit 3ea4f161cf

View file

@ -95,6 +95,12 @@ void AbstractBackend::updateCursorImage(Qt::CursorShape shape)
// check whether we can create it // check whether we can create it
if (waylandServer() && waylandServer()->internalShmPool()) { if (waylandServer() && waylandServer()->internalShmPool()) {
m_cursorTheme = new WaylandCursorTheme(waylandServer()->internalShmPool(), this); m_cursorTheme = new WaylandCursorTheme(waylandServer()->internalShmPool(), this);
connect(waylandServer(), &WaylandServer::terminatingInternalClientConnection, this,
[this] {
delete m_cursorTheme;
m_cursorTheme = nullptr;
}
);
} }
} }
if (!m_cursorTheme) { if (!m_cursorTheme) {