Bug 386648

Summary: project manager doesn't always reload emptied directories
Product: [Developer tools] kdevplatform Reporter: RJVB <rjvbertin>
Component: projectAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: mail
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: All   
Latest Commit: Version Fixed In: 5.2.1
Attachments: fix

Description RJVB 2017-11-08 13:37:21 UTC
Created attachment 108745 [details]
fix

I've been noticing an issue that appears to express itself more easily with directories called "devel" than others (but that ought to be just an artefact):

For a tree structure loaded in a KDevelop project, do

> touch /path/to/project/a/b/files/devel/aaa

An item `a/b/files/devel/aaa` will show up in the project tree

Now do

> rm /path/to/project/a/b/files/devel/aaa

The item will disappear but only if it isn't the last item in the directory.

This glitch is fixed when I remove 3 old (7y) lines from AFMPP::addJobItems(); see the attached patch. Seems rather self-evident: that function should not return without having removed stale/obsolete entries from the directory if no other function takes care of that housekeeping.
Comment 1 Sven Brauch 2017-11-08 15:16:22 UTC
I didn't look at the context, but what you say makes sense given the described bug. If you checked that nothing in the function relies on the list not being empty, please submit. Thanks!

Also, patches are easier to review on phabricator ;)
Comment 2 RJVB 2017-11-08 16:25:58 UTC
Yeah, I know, but this is a bug and I didn't want to pretend I was 100% certain of my fix.

Anyway, the list is only used in a foreach loop, so removing the check should be safe.
Comment 3 RJVB 2017-11-08 16:32:11 UTC
Git commit 54ab8b8c6717dec9087aa8482b735571a170e5e3 by R.J.V. Bertin.
Committed on 08/11/2017 at 16:31.
Pushed by rjvbb into branch '5.2'.

don't skip empty directories

AbstractFileManagerPluginPrivate::addJobItems() returned immediately
when called with an empty entries list, thus failing to do required
houskeeping. As a result the project manager would continue to show the
last file deleted from now empty directories.

M  +0    -4    kdevplatform/project/abstractfilemanagerplugin.cpp

https://commits.kde.org/kdevelop/54ab8b8c6717dec9087aa8482b735571a170e5e3