diff options
author | David Edmundson <davidedmundson@kde.org> | 2023-05-18 13:36:27 +0300 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2023-05-23 17:26:59 +0300 |
commit | 8b1b26d5e17c45c2b8db3d16b9fbd2d373626d90 (patch) | |
tree | f8a3c0e875bca22931e49e708ff9eb9ec4f22848 /tests/auto/client/shared/coreprotocol.h | |
parent | 4af0e67e9a9c5ada5ce6639726c2a39d6e5e1267 (diff) |
tests: Cleanup cursor role objects
They should have the same lifetime as the underlying surface
Change-Id: I35ad0377a506a4e18e7d4f37691189f636ae54bf
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests/auto/client/shared/coreprotocol.h')
-rw-r--r-- | tests/auto/client/shared/coreprotocol.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/client/shared/coreprotocol.h b/tests/auto/client/shared/coreprotocol.h index 8703fe1d3..e41c719e8 100644 --- a/tests/auto/client/shared/coreprotocol.h +++ b/tests/auto/client/shared/coreprotocol.h @@ -337,7 +337,7 @@ class Pointer : public QObject, public QtWaylandServer::wl_pointer public: explicit Pointer(Seat *seat) : m_seat(seat) {} Surface *cursorSurface(); - CursorRole* m_cursorRole = nullptr; //TODO: cleanup + QPointer<CursorRole> m_cursorRole; void send_enter() = delete; uint sendEnter(Surface *surface, const QPointF &position); void send_leave() = delete; @@ -369,6 +369,7 @@ public: explicit CursorRole(Surface *surface) // TODO: needs some more args : m_surface(surface) { + connect(m_surface, &QObject::destroyed, this, &QObject::deleteLater); } static CursorRole *fromSurface(Surface *surface) { return qobject_cast<CursorRole *>(surface->m_role); } Surface *m_surface = nullptr; |