]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Stop listing children of collapsed folders
authorFrank Reininghaus <frank78ac@googlemail.com>
Tue, 13 May 2014 17:06:42 +0000 (19:06 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Tue, 13 May 2014 17:06:42 +0000 (19:06 +0200)
Before this patch, KDirLister would continue listing any children of
collapsed folders, even though the children themselves were removed
from the model. This could lead to new items being inserted as
top-level items at some later point, because no parent could be found
for them. This inconsistent model state could lead to a crash later on.

Many thanks to Martin Koller for helping to debug this problem!

BUG: 332102
REVIEW: 118055
FIXED-IN: 4.13.2

src/kitemviews/kfileitemmodel.cpp

index 34a97de4c01e4ebff9549a8ef43093e77fac3d2a..de3c3eb22e26dacf50fb3ae7c24f6c507d47600d 100644 (file)
@@ -512,7 +512,9 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
             ItemData* itemData = m_itemData.at(childIndex);
             if (itemData->values.value("isExpanded").toBool()) {
                 const KUrl targetUrl = itemData->item.targetUrl();
             ItemData* itemData = m_itemData.at(childIndex);
             if (itemData->values.value("isExpanded").toBool()) {
                 const KUrl targetUrl = itemData->item.targetUrl();
+                const KUrl url = itemData->item.url();
                 m_expandedDirs.remove(targetUrl);
                 m_expandedDirs.remove(targetUrl);
+                m_dirLister->stop(url);     // TODO: try to unit-test this, see https://bugs.kde.org/show_bug.cgi?id=332102#c11
                 expandedChildren.append(targetUrl);
             }
             ++childIndex;
                 expandedChildren.append(targetUrl);
             }
             ++childIndex;