Commit de45732b authored by Alex Richardson's avatar Alex Richardson
Browse files

libtaskmanager: Fix invalid dataChanged() signal emission

Calling dataChanged() with an invalid QModelIndex() triggered an assertion
inside QConcatenateTablesProxyModel (my Qt is built with assertions):
ASSERT: "from.isValid()" in file $HOME/cheri/qt5/qtbase/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp, line 623
parent 7f308065
Pipeline #180026 passed with stage
in 9 minutes and 36 seconds
......@@ -189,7 +189,13 @@ void XWindowTasksModel::Private::init()
});
QObject::connect(KWindowSystem::self(), &KWindowSystem::stackingOrderChanged, q, [this]() {
// No need to do anything if the model is empty. This avoids calling q->dataChanged with an invalid QModelIndex.
if (q->rowCount() == 0) {
return;
}
cachedStackingOrder = KWindowSystem::stackingOrder();
Q_ASSERT(q->hasIndex(0, 0));
Q_ASSERT(q->hasIndex(q->rowCount() - 1, 0));
Q_EMIT q->dataChanged(q->index(0, 0), q->index(q->rowCount() - 1, 0), QVector<int>{StackingOrder});
});
......
Supports Markdown
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