Commit e925f98e authored by David Edmundson's avatar David Edmundson
Browse files

Cache clientConnection in SurfaceInterface

Order of a client teardown is:
 - ClientConnection is removed from the static map
 - All our client owned resources are torn down
 - ClientConnection is deleted (via a previous deleteLater)

The recent refactor led to a behavioural change where ::client could
return a null pointer.

We want the client getter to be valid throughout the lifespan of
SurfaceInterface, by doing the lookup once we achieve that.

BUG: 424255
parent 753e582f
......@@ -391,6 +391,7 @@ SurfaceInterface::SurfaceInterface(CompositorInterface *compositor, wl_resource
{
d->compositor = compositor;
d->init(resource);
d->client = compositor->display()->getConnection(d->resource()->client());
}
SurfaceInterface::~SurfaceInterface()
......@@ -404,7 +405,7 @@ uint32_t SurfaceInterface::id() const
ClientConnection *SurfaceInterface::client() const
{
return d->compositor->display()->getConnection(d->resource()->client());
return d->client;
}
wl_resource *SurfaceInterface::resource() const
......
......@@ -122,6 +122,8 @@ public:
static QList<SurfaceInterface *> surfaces;
ClientConnection *client = nullptr;
protected:
void surface_destroy_resource(Resource *resource) override;
void surface_destroy(Resource *resource) override;
......
Markdown is supported
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