[server] Introduce a Resource::unbound signal emitted from unbind handler
ClosedPublic

Authored by graesslin on Jun 14 2016, 12:55 PM.

Details

Summary

So far for internal cleanup we mostly listen to QObject::destroyed.
When a Resource gets unbind the wl_resource is set to null and the
Resource gets deleteLater. This creates a short time frame when the
Resource is still there, but the wl_resource is null. For most internal
usages the Resource is completely useless at that point and should no
longer be considered. So far it was still considered and could hit
crashers, if a code path did not nullptr check. Unfortunately
libwayland-server is not nullptr safe: if called with a null value it
tends to crash.

So this check introduces a new signal unbound which can be listend to
in addition to the destroyed signal. It's used in SeatInterface for
DataDeviceInterface, where we experienced a crash related to that.

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.
graesslin updated this revision to Diff 4456.Jun 14 2016, 12:55 PM
graesslin retitled this revision from to [server] Introduce a Resource::unbound signal emitted from unbind handler.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
graesslin added a reviewer: Plasma on Wayland.
Restricted Application added a project: Plasma on Wayland. · View Herald TranscriptJun 14 2016, 12:55 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
sebas accepted this revision.Jun 14 2016, 12:55 PM
sebas added a reviewer: sebas.
This revision is now accepted and ready to land.Jun 14 2016, 12:55 PM
bshah accepted this revision.Jun 14 2016, 1:51 PM
bshah added a reviewer: bshah.
graesslin updated this revision to Diff 4483.Jun 15 2016, 7:07 AM
graesslin edited edge metadata.
  • Added test case to expose the problem
  • With that also adding the needed nullptr check in DataDeviceInterface
bshah added a comment.Jun 15 2016, 7:11 AM

Looks good, can't re-accept so shipit!

This revision was automatically updated to reflect the committed changes.