Question about KDirLister and hiding expanded directories

Frank Reininghaus frank78ac at googlemail.com
Tue Feb 12 11:40:02 GMT 2013


Hi,

2013/1/5 Frank Reininghaus:
> Hi David,
>
> after debugging a Dolphin crash,
>
> https://bugs.kde.org/show_bug.cgi?id=311947
>
> I have another question about KDirLister. The problem is the
> following: assuming we have folders ~/a and ~/a/b, renaming ~/a to
> ~/.a (and thus hiding it) will have the following effects:
>
> 1. KDirLister's refreshItems signal reports that the name of ~/a/b
> changes to ~/.a/b.
> 2. It then reports that ~/a has been deleted.
>
> The problem is now that
> KFileItemModel::slotItemsDeleted(KFileItemList), which tries to find
> all children of removed items to remove them as well, cannot detect
> that ~/.a/b is a child of the deleted ~/a. Therefore, we have an item
> with a dangling 'parent' and get a crash when that is dereferenced.
>
> KDirModel does not suffer from this problem because each
> KDirModelDirNode node keeps a list of its children, so the
> parent-child relationship is not affected by the ~/a/b -> ~/.a/b
> change.
>
> OTOH, KFileItemModel stores all items in a QList and determines the
> children of an item by simply taking all following items with a larger
> expansion level, until an item with the same (or a smaller) expansion
> level as the parent is found.
>
> So my question is: Would you agree that emitting the refreshItems
> signal for a child of the directory that is being hidden is sort of
> unexpected? And if yes, is there an easy way to fix this?

I've found a way to fix this issue inside Dolphin:

https://git.reviewboard.kde.org/r/108766/

(has been pushed to master already).

Best regards,
Frank




More information about the kfm-devel mailing list