diff --git a/libtaskmanager/tasksmodel.cpp b/libtaskmanager/tasksmodel.cpp --- a/libtaskmanager/tasksmodel.cpp +++ b/libtaskmanager/tasksmodel.cpp @@ -305,12 +305,14 @@ return; } + bool demandsAttentionUpdateNeeded = false; + for (int i = first; i <= last; ++i) { const QModelIndex &sourceIndex = groupingProxyModel->index(i, 0); const QString &appId = sourceIndex.data(AbstractTasksModel::AppId).toString(); if (sourceIndex.data(AbstractTasksModel::IsDemandingAttention).toBool()) { - updateAnyTaskDemandsAttention(); + demandsAttentionUpdateNeeded = true; } // When we get a window we have a startup for, cause the startup to be re-filtered. @@ -347,6 +349,10 @@ } } } + + if (!anyTaskDemandsAttention && demandsAttentionUpdateNeeded) { + updateAnyTaskDemandsAttention(); + } } ); @@ -360,10 +366,6 @@ for (int i = first; i <= last; ++i) { const QModelIndex &sourceIndex = groupingProxyModel->index(i, 0); - if (sourceIndex.data(AbstractTasksModel::IsDemandingAttention).toBool()) { - updateAnyTaskDemandsAttention(); - } - // When a window or startup task is removed, we have to trigger a re-filter of // our launchers to (possibly) pop them back in. // NOTE: An older revision of this code compared the window and startup tasks @@ -404,6 +406,13 @@ launcherCheckNeeded = false; } + + // One of the removed tasks might have been demanding attention, but + // we can't check the state after the window has been closed already, + // so we always have to do a full update. + if (anyTaskDemandsAttention) { + updateAnyTaskDemandsAttention(); + } } );