<table><tr><td style="">Fuchs added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D12462">View Revision</a></tr></table><br /><div><div><p>On the existing bug: it's related to the TODO, changing that to</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">for (int i = 0; i < d->concatProxyModel->rowCount(); ++i) {
    const QModelIndex &itIndex = d->concatProxyModel->index(i, 0);

    // Launchers can't be pinned / unpinned
    if (itIndex.data(AbstractTasksModel::IsLauncher).toBool()) {
        continue;
    }
    
    dataChanged(itIndex, itIndex, QVector<int>{AbstractTasksModel::IsPinned});
    
}</pre></div>

<p>fixes the bug, but of course that goes through all items and not only the needed ones, so it's bad performance-wise.</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"></pre></div>

<p>Oddly enough, changing the second part to</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">// Check all windows if they match, then update the isPinned for them too. 
// This is needed so if you pin / unpin an app that has multiple instances open, all are updated.
if (appsMatch(index, itIndex)) {
    dataChanged(itIndex, itIndex, QVector<int>{AbstractTasksModel::IsPinned});
}</pre></div>

<p>matched only parts of the same window, so if I e.g. had 3 konsole instances open, it affected 2/3 sometimes.</p>

<p>No idea what I am doing wrong here, hopefully <a href="https://phabricator.kde.org/p/hein/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@hein</a>  will know what list I best iterate over and how to best compare them, so it's not only fixed, but fixed without performance impact.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R120 Plasma Workspace</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D12462">https://phabricator.kde.org/D12462</a></div></div><br /><div><strong>To: </strong>Fuchs, hein<br /><strong>Cc: </strong>plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>