Cleanup RemoteAccess buffers on aboutToBeUnbound instead of object destruction
ClosedPublic

Authored by davidedmundson on Jul 23 2018, 9:56 AM.

Details

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.

Diff Detail

Repository
R127 KWayland
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Jul 23 2018, 9:56 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 23 2018, 9:56 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
davidedmundson requested review of this revision.Jul 23 2018, 9:56 AM
romangg accepted this revision.Jul 23 2018, 4:15 PM
romangg added a subscriber: romangg.
romangg added inline comments.
src/server/remote_access_interface.cpp
244

Why p->q? Isn't just p enough? Or since getBufferCallback is static, leave the slot without object relation? Just connect to the functor as before. But in the end that all doesn't matter much.

251

If the problem is only this call to id(), then maybe one could just hand over this value to the lambda instead of accessing rbuf. But connecting to the aboutToBeUnbound signal is also fine.

This revision is now accepted and ready to land.Jul 23 2018, 4:15 PM
This revision was automatically updated to reflect the committed changes.