Commit 63102e12 authored by Martin Flöser's avatar Martin Flöser
Browse files

[client] Properly track enteredSurface in Keyboard

Summary:
ASAN found a heap-use-after-free when deleting the focused keyboard
surface in the client library. Keyboard did not track the lifetime of
the focused surface and thus one can access already freed memory.

Test Plan: Adjusted auto test to verify the variable gets cleared

Reviewers: #frameworks, #plasma

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D6741
parent 9266a944
......@@ -1562,7 +1562,9 @@ void TestWaylandSeat::testKeyboard()
QSignalSpy serverSurfaceDestroyedSpy(serverSurface, &QObject::destroyed);
QVERIFY(serverSurfaceDestroyedSpy.isValid());
QCOMPARE(keyboard->enteredSurface(), s);
delete s;
QVERIFY(!keyboard->enteredSurface());
QVERIFY(leftSpy.wait());
QCOMPARE(serverSurfaceDestroyedSpy.count(), 1);
QVERIFY(!m_seatInterface->focusedKeyboardSurface());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment