[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
This commit is contained in:
parent
9266a94400
commit
63102e1215
1 changed files with 2 additions and 0 deletions
|
@ -1562,7 +1562,9 @@ void TestWaylandSeat::testKeyboard()
|
||||||
|
|
||||||
QSignalSpy serverSurfaceDestroyedSpy(serverSurface, &QObject::destroyed);
|
QSignalSpy serverSurfaceDestroyedSpy(serverSurface, &QObject::destroyed);
|
||||||
QVERIFY(serverSurfaceDestroyedSpy.isValid());
|
QVERIFY(serverSurfaceDestroyedSpy.isValid());
|
||||||
|
QCOMPARE(keyboard->enteredSurface(), s);
|
||||||
delete s;
|
delete s;
|
||||||
|
QVERIFY(!keyboard->enteredSurface());
|
||||||
QVERIFY(leftSpy.wait());
|
QVERIFY(leftSpy.wait());
|
||||||
QCOMPARE(serverSurfaceDestroyedSpy.count(), 1);
|
QCOMPARE(serverSurfaceDestroyedSpy.count(), 1);
|
||||||
QVERIFY(!m_seatInterface->focusedKeyboardSurface());
|
QVERIFY(!m_seatInterface->focusedKeyboardSurface());
|
||||||
|
|
Loading…
Reference in a new issue