diff --git a/libtaskmanager/xwindowtasksmodel.cpp b/libtaskmanager/xwindowtasksmodel.cpp --- a/libtaskmanager/xwindowtasksmodel.cpp +++ b/libtaskmanager/xwindowtasksmodel.cpp @@ -307,20 +307,22 @@ const KWindowInfo info(window, NET::WMState | NET::XAWMState, NET::WM2TransientFor); if (info.hasState(NET::DemandsAttention)) { - WId oldLeader = info.transientFor(); + const WId leader = info.transientFor(); + WId oldLeader = 0; QMutableHashIterator i(transientsDemandingAttention); while (i.hasNext()) { i.next(); if (i.value() == window) { oldLeader = i.key(); - i.remove(); + + break; } } - if (oldLeader != 0) { - const WId leader = info.transientFor(); + if (oldLeader != 0 && leader != oldLeader) { + i.remove(); transientsDemandingAttention.insertMulti(leader, window); dataChanged(oldLeader, QVector{IsDemandingAttention}); dataChanged(leader, QVector{IsDemandingAttention});