diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-01-05 12:31:15 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-02-01 08:25:34 +0000 |
commit | ebe5f6097af0fd01b3733ebd4d920f710e4b186a (patch) | |
tree | e047438e003442b716a651fa2bb8a40d064443d1 | |
parent | 6c1499b227324e29cece5651fa00c812d9e01709 (diff) | |
download | qtwayland-ebe5f6097af0fd01b3733ebd4d920f710e4b186a.tar.gz |
Test that xdg_toplevel_v6s are destroyed before xdg_surface_v6s
Adds an assert so tst_WaylandClientXdgShellV6::createDestroyWindow verifies
deletion order.
Task-number: QTBUG-65568
Change-Id: I0b4dd350f811495a9c7a78811915647fb713a43a
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
-rw-r--r-- | tests/auto/client/shared/mockxdgshellv6.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/auto/client/shared/mockxdgshellv6.cpp b/tests/auto/client/shared/mockxdgshellv6.cpp index fe9d1185..b26ac1c8 100644 --- a/tests/auto/client/shared/mockxdgshellv6.cpp +++ b/tests/auto/client/shared/mockxdgshellv6.cpp @@ -33,24 +33,41 @@ namespace Impl { +class XdgSurfaceV6; + class XdgToplevelV6 : public QtWaylandServer::zxdg_toplevel_v6 { public: - XdgToplevelV6(wl_client *client, uint32_t id, int version) + XdgToplevelV6(XdgSurfaceV6 *xdgSurface, wl_client *client, uint32_t id, int version) : QtWaylandServer::zxdg_toplevel_v6(client, id, version) + , m_xdgSurface(xdgSurface) {} - void zxdg_toplevel_v6_destroy_resource(Resource *resource) override { delete this; } + void zxdg_toplevel_v6_destroy_resource(Resource *) override { delete this; } + void zxdg_toplevel_v6_destroy(Resource *resource) override; + XdgSurfaceV6 *m_xdgSurface = nullptr; }; class XdgSurfaceV6 : public QtWaylandServer::zxdg_surface_v6 { public: XdgSurfaceV6(wl_client *client, uint32_t id, int version, Surface *surface); - void zxdg_surface_v6_destroy_resource(Resource *resource) override { delete this; } + void zxdg_surface_v6_destroy_resource(Resource *) override { delete this; } void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override; + void zxdg_surface_v6_destroy(Resource *resource) override + { + Q_ASSERT(!m_toplevel); + wl_resource_destroy(resource->handle); + } Surface *m_surface = nullptr; + XdgToplevelV6 *m_toplevel = nullptr; }; +void XdgToplevelV6::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) +{ + m_xdgSurface->m_toplevel = nullptr; + wl_resource_destroy(resource->handle); +} + XdgSurfaceV6::XdgSurfaceV6(wl_client *client, uint32_t id, int version, Surface *surface) : QtWaylandServer::zxdg_surface_v6(client, id, version) , m_surface(surface) @@ -60,7 +77,7 @@ XdgSurfaceV6::XdgSurfaceV6(wl_client *client, uint32_t id, int version, Surface void XdgSurfaceV6::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id) { int version = wl_resource_get_version(resource->handle); - new XdgToplevelV6(resource->client(), id, version); + m_toplevel = new XdgToplevelV6(this, resource->client(), id, version); m_surface->map(); } |