diff --git a/libnotificationmanager/limitedrowcountproxymodel.cpp b/libnotificationmanager/limitedrowcountproxymodel.cpp --- a/libnotificationmanager/limitedrowcountproxymodel.cpp +++ b/libnotificationmanager/limitedrowcountproxymodel.cpp @@ -34,8 +34,12 @@ 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); diff --git a/libnotificationmanager/notificationgroupcollapsingproxymodel.cpp b/libnotificationmanager/notificationgroupcollapsingproxymodel.cpp --- a/libnotificationmanager/notificationgroupcollapsingproxymodel.cpp +++ b/libnotificationmanager/notificationgroupcollapsingproxymodel.cpp @@ -36,8 +36,12 @@ 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);