Cleanup RemoteAccess buffers on aboutToBeUnbound instead of object destruction
Summary: 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 contents. Based on https://build.kde.org/view/Frameworks/job/Frameworks%20kwayland%20kf5-qt5%20SUSEQt5.10/71/testReport/ 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: https://phabricator.kde.org/D14291
This commit is contained in:
parent
a2489a4110
commit
2a3b34ae6a
1 changed files with 1 additions and 2 deletions
|
@ -241,13 +241,12 @@ void RemoteAccessManagerInterface::Private::getBufferCallback(wl_client *client,
|
|||
return;
|
||||
}
|
||||
|
||||
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
|
||||
return;
|
||||
}
|
||||
|
||||
qCDebug(KWAYLAND_SERVER) << "Remote buffer returned, client" << wl_resource_get_id(resource)
|
||||
<< ", id" << rbuf->id()
|
||||
<< ", fd" << bh.buf->fd();
|
||||
|
|
Loading…
Reference in a new issue