Review Request: Fixes Bug 304878 - Dolphin shows "ghost" folders in places after autofs umount nfs shares

Frank Reininghaus frank78ac at googlemail.com
Mon Sep 17 09:39:34 BST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/106456/#review19052
-----------------------------------------------------------


Thanks for analysing this annyoing issue and finding out where the mysterious 'ghost' entry finds its way into the PlacesItemModel!

I can confirm that your patch fixes the problem, and usually, I like small patches a lot :-) However, your fix will introduce a memory leak - the PlacesItem with the empty text() will not be added to the model, but will not be deleted either. One could delete it in an 'else' branch in PlacesItemModel::appendItemToGroup(PlacesItem* item), of course, but I think I would prefer to not even create the 'ghost' PlacesItem in the first place.

I've just had a thorough look at the relevant code (which I'm not really familiar with) to check how a PlacesItem can get an empty text(). In PlacesItemModel::updateBookmarks(), after "if (!found)", the new PlacesItem is constructed, which causes a call of PlacesItem::setBookmark(const KBookmark&). If the bookmark's UDI is not empty, that will call PlacesItem::initializeDevice(const QString& udi), which will then just return if the UDI does not belong to a valid device (which is the case here because the device has been removed).

At the moment, I think it would be best to fix it in PlacesItemModel::updateBookmarks(). At the beginning of the "if (!found)" branch, one could add a check to verify if the item would get an non-empty text (i.e., check if the bookmark's UDI is empty || the UDI belongs to a valid device) and create the PlacesItem only if that is the case. A small comment with a reference to the bug report would not hurt.

If you have other ideas, just let me know!


- Frank Reininghaus


On Sept. 16, 2012, 7:37 p.m., Emmanuel Pescosta wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/106456/
> -----------------------------------------------------------
> 
> (Updated Sept. 16, 2012, 7:37 p.m.)
> 
> 
> Review request for Dolphin and Frank Reininghaus.
> 
> 
> Description
> -------
> 
> Fixes Bug 304878 - Dolphin shows "ghost" folders in places after autofs umount nfs shares 
> 
> Patch tested with a usb storage device, thanks to Weng Xuetian. His way to reproduce it:
> 1. open dolphin
> 2. plug a usb disk
> 3. mount a partition
> 4. unplug without unmount it.
> 5. ghost entry appears.
> 
> 
> This addresses bug 304878.
>     http://bugs.kde.org/show_bug.cgi?id=304878
> 
> 
> Diffs
> -----
> 
>   dolphin/src/panels/places/placesitemmodel.cpp 5eb1c35 
> 
> Diff: http://git.reviewboard.kde.org/r/106456/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Emmanuel Pescosta
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20120917/0c4f4bd5/attachment.htm>


More information about the kfm-devel mailing list