D16663: [import] Use QSharedPointer for file filters
Christoph Roick
noreply at phabricator.kde.org
Sun Dec 2 12:46:29 GMT 2018
croick added a comment.
In D16663#367765 <https://phabricator.kde.org/D16663#367765>, @asemke wrote:
> - QSharedPointer has additional overhead for reference counting which we don't need in this case. Can we use std::unique_ptr here?
Whenever `LiveDataSourcce::setFilter(currentFileFilter())` is called, we cannot know whether the filter object will exist, when it's used in a LiveDataSource.
For example, in `MainWin::newLiveDataSourceActionTriggered()` a filter is set by `ImportFileWidget`, which then is deleted as a child of `ImportFileDialog`:
...
else {
LiveDataSource* dataSource = new LiveDataSource(i18n("Live data source%1", 1), false);
dlg->importToLiveDataSource(dataSource, statusBar());
this->addAspectToProject(dataSource);
}
}
delete dlg;
So for the code as it is, I think reference counting is required. But sure, its use can be limited.
REPOSITORY
R262 LabPlot
REVISION DETAIL
https://phabricator.kde.org/D16663
To: croick, #labplot, asemke
Cc: asemke, kde-edu, narvaez, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20181202/b7c10b5d/attachment.html>
More information about the kde-edu
mailing list