Bug 300504

Summary: Dolphin sometimes doesn't show all files after closing filter bar
Product: [Applications] dolphin Reporter: Mathias Kosch <info>
Component: view-engine: generalAssignee: Peter Penz <peter.penz19>
Status: RESOLVED FIXED    
Severity: grave CC: frank78ac, gedgon, info
Priority: NOR    
Version: 2.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 4.8.4
Sentry Crash Report:

Description Mathias Kosch 2012-05-23 14:45:26 UTC
When I open a folder with many files, open the filter bar ("Strg + I"), type in any text and immediately close the filter bar using the close button next to it, then dolphin sometimes (or always?)  doesn't show all files inside this folder. File operations selecting all files with "Strg + A" or drag & drop are performed on the visible sub-set of files. In order to view all files again, I have to hit the refresh button.

Reproducible: Sometimes

Steps to Reproduce:
1. Open a folder with many files (i.e. my home folder containing 174 folders and 135 files).
2. Hit "Strg + A" to see the number of files in the status bar (i.e. my home folder shows 174 folders and 135 files).
3. Open the filter bar and type in any text (i.e. "foo").
4. Hit the close button next to the filter bar.
5. Hit "Strg + A" to see the number of files in the status bar (i.e. my home folder now shows 139 folders and 111 files).
Actual Results:  
In the described test case my home folder shew 139 folders and 111 files.

Expected Results:  
My home folder should have shown 174 folders and 135 files.
Comment 1 Peter Penz 2012-05-23 15:50:02 UTC
Thanks for the report. Could you please let us know your exact KDE version? If possible it would be great if you could attach a minimal zipped directory where this issue is reproducible for you, as currently I'm not able to reproduce the issue with the steps above.
Comment 2 gedgon 2012-05-25 02:55:49 UTC
Hi Peter, I can confirm this in 4.8.3. Happens every time in any folder with about 20+ items.
http://youtu.be/D3J1Jxpp9q0
Comment 3 Mathias Kosch 2012-05-25 21:57:10 UTC
I'm also running KDE 4.8.3 (from openSUSE Tumbleweed).

Unfortunately, the issue doesn't appear in every case. I created a directory containing 36 empty files (0-9, a-z) and experienced the issue. Then I deleted the directory and created it again (after a while) with the same files, but this time, I didn't encounter the issue. I created even more files and folders (88 items in total), but the issue is still not present. However, other large directories, even a small one with only 20 items, show this issue.
Comment 4 Peter Penz 2012-05-26 11:17:47 UTC
@Gedgon: Thanks for this good hint - I can reproduce this issue reliable with one directory on 4.8.3 + master; I'll try to come up with a fix until 4.9.0
Comment 5 Frank Reininghaus 2012-05-26 14:34:39 UTC
Git commit 288473a96cdd8888f7fc91d0a551d6cbde5fd5dc by Frank Reininghaus.
Committed on 26/05/2012 at 16:29.
Pushed by freininghaus into branch 'KDE/4.8'.

Show all items in the directory when the name filter is cleared

The problem was the following: While a QMutableSetIterator iterates the
items in the QSet m_filteredItems, all items that match the new filter
are removed from the set. However, to ensure that the iterator still
reaches all items in the set, one must not use QSet::remove(), but
rather the iterator's remove() method (see QMutableSetIterator docs).
FIXED-IN: 4.8.4

M  +1    -1    dolphin/src/kitemviews/kfileitemmodel.cpp

http://commits.kde.org/kde-baseapps/288473a96cdd8888f7fc91d0a551d6cbde5fd5dc
Comment 6 Frank Reininghaus 2012-05-26 14:37:14 UTC
Git commit 6b15e2722195800f87daacd9e09fa8daa5315f3e by Frank Reininghaus.
Committed on 26/05/2012 at 16:29.
Pushed by freininghaus into branch 'master'.

Show all items in the directory when the name filter is cleared

The problem was the following: While a QMutableSetIterator iterates the
items in the QSet m_filteredItems, all items that match the new filter
are removed from the set. However, to ensure that the iterator still
reaches all items in the set, one must not use QSet::remove(), but
rather the iterator's remove() method (see QMutableSetIterator docs).
(cherry picked from commit 288473a96cdd8888f7fc91d0a551d6cbde5fd5dc)

M  +1    -1    dolphin/src/kitemviews/kfileitemmodel.cpp

http://commits.kde.org/kde-baseapps/6b15e2722195800f87daacd9e09fa8daa5315f3e
Comment 7 Peter Penz 2012-05-26 15:38:18 UTC
> I'll try to come up with a fix until 4.9.0

Frank was a lot faster than me ;-) Thanks Frank!