diff --git a/autotests/client/test_wayland_seat.cpp b/autotests/client/test_wayland_seat.cpp --- a/autotests/client/test_wayland_seat.cpp +++ b/autotests/client/test_wayland_seat.cpp @@ -591,10 +591,11 @@ QSignalSpy entered2Spy(p, &Pointer::entered); QVERIFY(entered2Spy.wait()); QCOMPARE(p->enteredSurface(), s); + QSignalSpy leftSpy2(p, &Pointer::left); + QVERIFY(leftSpy2.isValid()); delete s; QVERIFY(!p->enteredSurface()); - wl_display_flush(m_connection->display()); - QVERIFY(focusedPointerChangedSpy.wait()); + QVERIFY(leftSpy2.wait()); QCOMPARE(focusedPointerChangedSpy.count(), 10); QVERIFY(!m_seatInterface->focusedPointerSurface()); QVERIFY(!m_seatInterface->focusedPointer()); diff --git a/src/server/pointer_interface.cpp b/src/server/pointer_interface.cpp --- a/src/server/pointer_interface.cpp +++ b/src/server/pointer_interface.cpp @@ -265,9 +265,10 @@ return; } d->focusedSurface = surface; - d->destroyConnection = connect(d->focusedSurface, &QObject::destroyed, this, + d->destroyConnection = connect(d->focusedSurface, &Resource::aboutToBeUnbound, this, [this] { Q_D(); + d->sendLeave(d->focusedChildSurface.data(), d->global->display()->nextSerial()); d->focusedSurface = nullptr; d->focusedChildSurface.clear(); }