Make data source objects "parentless"
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
This commit is contained in:
parent
fd3a7c3c99
commit
c793dd93d2
3 changed files with 4 additions and 6 deletions
|
@ -94,8 +94,7 @@ void DataSourceInterfacePrivate::data_source_set_actions(Resource *resource, uin
|
|||
}
|
||||
|
||||
DataSourceInterface::DataSourceInterface(DataDeviceManagerInterface *parent, wl_resource *resource)
|
||||
: AbstractDataSource(parent)
|
||||
, d(new DataSourceInterfacePrivate(this, resource))
|
||||
: d(new DataSourceInterfacePrivate(this, resource))
|
||||
{
|
||||
if (d->resource()->version() < WL_DATA_SOURCE_ACTION_SINCE_VERSION) {
|
||||
d->supportedDnDActions = DataDeviceManagerInterface::DnDAction::Copy;
|
||||
|
|
|
@ -56,8 +56,7 @@ void PrimarySelectionSourceV1InterfacePrivate::zwp_primary_selection_source_v1_d
|
|||
}
|
||||
|
||||
PrimarySelectionSourceV1Interface::PrimarySelectionSourceV1Interface(PrimarySelectionDeviceManagerV1Interface *parent, ::wl_resource *resource)
|
||||
: AbstractDataSource(parent)
|
||||
, d(new PrimarySelectionSourceV1InterfacePrivate(this, resource))
|
||||
: d(new PrimarySelectionSourceV1InterfacePrivate(this, resource))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1239,7 +1239,7 @@ void SeatInterface::setSelection(AbstractDataSource *selection)
|
|||
auto cleanup = [this]() {
|
||||
setSelection(nullptr);
|
||||
};
|
||||
connect(selection, &DataSourceInterface::aboutToBeDestroyed, this, cleanup);
|
||||
connect(selection, &AbstractDataSource::aboutToBeDestroyed, this, cleanup);
|
||||
}
|
||||
|
||||
d->currentSelection = selection;
|
||||
|
@ -1282,7 +1282,7 @@ void SeatInterface::setPrimarySelection(AbstractDataSource *selection)
|
|||
auto cleanup = [this]() {
|
||||
setPrimarySelection(nullptr);
|
||||
};
|
||||
connect(selection, &DataSourceInterface::aboutToBeDestroyed, this, cleanup);
|
||||
connect(selection, &AbstractDataSource::aboutToBeDestroyed, this, cleanup);
|
||||
}
|
||||
|
||||
d->currentPrimarySelection = selection;
|
||||
|
|
Loading…
Reference in a new issue