Commit 2a3b34ae authored by David Edmundson's avatar David Edmundson
Browse files

Cleanup RemoteAccess buffers on aboutToBeUnbound instead of object destruction

The destructor or Resource::~Resource will delete the d-pointer used by
Resource before we reach QObject::~QObject() of the resource which emits
the destroyed signal. This means this lamba is accessing deleted

Based on

aboutToBeUnbound is emitted before object destruction.

Test Plan: Relevant unit test still passes and this lambda is still invoked.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision:
parent a2489a41
......@@ -241,13 +241,12 @@ void RemoteAccessManagerInterface::Private::getBufferCallback(wl_client *client,
QObject::connect(rbuf, &QObject::destroyed, [p, rbuf, resource, &bh] {
QObject::connect(rbuf, &Resource::aboutToBeUnbound, p->q, [p, rbuf, resource, &bh] {
if (!p->clientResources.contains(resource)) {
// remote buffer destroy confirmed after client is already gone
// all relevant buffers are already unreferenced
qCDebug(KWAYLAND_SERVER) << "Remote buffer returned, client" << wl_resource_get_id(resource)
<< ", id" << rbuf->id()
<< ", fd" << bh.buf->fd();
Supports Markdown
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