Bug 310080 - If a move a new item to the Places Panel, after restarting it appears in the last position
Summary: If a move a new item to the Places Panel, after restarting it appears in the ...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: panels: places (show other bugs)
Version: 2.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords: reproducible
Depends on:
Blocks:
 
Reported: 2012-11-14 11:01 UTC by J.A. Moray
Modified: 2015-02-19 19:10 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 14.12.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description J.A. Moray 2012-11-14 11:01:36 UTC
If a move a new item to the Places Panel, after restarting it appears in the last position, and I have to set the position I want again. After a second restart, it keeps that position.

Reproducible: Always

Steps to Reproduce:
1. Move a new item to the Places Panel (not in the last position)
2. Restart the system
3. That item will be in the last position
Actual Results:  
The item is in the last position.

Expected Results:  
Dolphin remembers the position you set.
Comment 1 Frank Reininghaus 2012-11-14 12:10:36 UTC
Thanks for the report. Just to be sure: Did you close Dolphin before restarting the system, or did you leave it open, such that it was restored when restoring the KDE session?

Moreover, could you try to do the same thing without using Dolphin at all, just by dragging a new item to the 'Places' in the Open/Save dialog of some application like, e.g., KWrite?

The fact that a system restart, rather than a restart of the Dolphin application, is required to reproduce the bug makes me think that this is most likely not a Dolphin bug.
Comment 2 J.A. Moray 2012-11-14 12:28:35 UTC
I close Dolphin before restart the system. Anyway, I have KDE configured to always start with an empty session.

I just tried what you said. First, I tried with Kate, and I had no problem. After that I tried with Ktorrent and no problem either. Finally, I tried once again with Dolphin and the bug happened.
Comment 3 Jekyll Wu 2012-11-14 12:42:50 UTC
Ahh, I didn't notice that "restart system". But actually I  can just reproduce it without restarting system. Just close dolphin and open it again.
Comment 4 Frank Reininghaus 2012-11-14 21:47:48 UTC
Thanks Jekyll! At the machine where I was sitting this afternoon, I could not reproduce the problem when just closing and restarting Dolphin, but here I can.
Comment 5 Frank Reininghaus 2012-11-14 23:01:52 UTC
Here is a short summary of what I found after an hour of debugging.

(Note: Another way to observe this strange behaviour is to open Dolphin and then the 'File' dialog from, e.g., KWrite. When dragging a folder to the 'Places' in KWrite to create a new 'Place', it shows up in Dolphin's Places Panel at the end. Restarting Dolphin moves it back to the correct position.)

When I enable debug output in PlacesItemModel, I see that the new 'Place' is first inserted at the right position, but is then moved to the end, both in the model and in the bookmark manager. 

Putting a breakpoint in PlacesItemModel::onItemInserted(), I see that the first call comes from PlacesPanel::slotAboveItemDropEvent(), as expected, but the second one, which moves the 'Place', from PlacesItemModel::updateBookmarks(), which calls PlacesItemModel::appendItemToGroup().

It looks like PlacesItemModel::updateBookmarks() is actually supposed to be invoked when the Places have been changed outside Dolphin (i.e., when attaching a USB drive).

The problem seems to be that the "if (!found)" in PlacesItemModel::updateBookmarks() is taken, even though the Place is already there. But I don't really see why that happens - needs further investigation.
Comment 6 Frank Reininghaus 2012-11-14 23:21:46 UTC
It looks like the new Place actually disappears from the bookmark manager between the insertion and the call to updateBookmarks(). I don't quite understand that.
Comment 7 Emmanuel Pescosta 2015-02-19 19:10:10 UTC
Git commit 2a79feaea0088730bbf4fd4b65baa1c4a91b84b9 by Emmanuel Pescosta.
Committed on 19/02/2015 at 19:05.
Pushed by emmanuelp into branch 'Applications/14.12'.

Sync bookmark manager only if the change was done by the current process

Adoption of http://commits.kde.org/kdelibs/2b5c6e42fc8114c6854ce490b9cdd4356be683d9

FIXED-IN: 14.12.3
Related: bug 343620
REVIEW: 122640

M  +0    -20   dolphin/src/panels/places/placesitemmodel.cpp
M  +8    -13   dolphin/src/panels/places/placesitemmodel.h
M  +5    -0    dolphin/src/panels/places/placespanel.cpp

http://commits.kde.org/kde-baseapps/2a79feaea0088730bbf4fd4b65baa1c4a91b84b9