Commit 1c0c8dde authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[Notifications] Fixup setSourceModel

Don't bother if the model is the same

Differential Revision: https://phabricator.kde.org/D27037
parent 31303ad3
......@@ -34,8 +34,12 @@ LimitedRowCountProxyModel::~LimitedRowCountProxyModel() = default;
void LimitedRowCountProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
{
if (this->sourceModel()) {
disconnect(this->sourceModel(), nullptr, this, nullptr);
if (sourceModel == QAbstractProxyModel::sourceModel()) {
return;
}
if (QAbstractProxyModel::sourceModel()) {
disconnect(QAbstractProxyModel::sourceModel(), nullptr, this, nullptr);
}
QSortFilterProxyModel::setSourceModel(sourceModel);
......
......@@ -36,8 +36,12 @@ NotificationGroupCollapsingProxyModel::~NotificationGroupCollapsingProxyModel()
void NotificationGroupCollapsingProxyModel::setSourceModel(QAbstractItemModel *source)
{
if (sourceModel()) {
disconnect(sourceModel(), nullptr, this, nullptr);
if (source == QAbstractProxyModel::sourceModel()) {
return;
}
if (QAbstractProxyModel::sourceModel()) {
disconnect(QAbstractProxyModel::sourceModel(), nullptr, this, nullptr);
}
QSortFilterProxyModel::setSourceModel(source);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment