The SeatInterface cleans up currentSelection and currentPrimarySelection
when the AbstractDataSource::aboutToBeDestroyed() signal is emitted, but
since the data source and primary data source have parent objects, they
can be potentially destroyed without emitting the aboutToBeDestroyed()
signal and thus leaving dangling pointers in SeatInterface.
CCBUG: 449101
Getting the object associated with the particular wl_resource is not
difficult, but it involves a pretty reasonable amount of boilerplate
code.
This change, introduces a helper function with an intend to reduce the
amount of boilerplate code.
It can be used as resource_cast<const ObjectPrivate *>(resource) or
just simply resource_cast<ObjectPrivate *>(resource).
This was done mostly because I wanted to get rid of the Resource
dependency in AbstractDataSource so I can make our xwl bridge direct,
but this also fixes up some issues with object lifespan present in the
previous version and keeps all our clipboard code in-line.