Bug 329377 - after many copy & paste & renaming of folders and files, suddenly dolphin selecting all folders about my selected folder
Summary: after many copy & paste & renaming of folders and files, suddenly dolphin sel...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 4.12.2
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords: reproducible
: 337393 338503 338911 349520 350347 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-12-29 18:06 UTC by Robert s.
Modified: 2015-08-09 16:03 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.14.0


Attachments
dolphin-20140109-213035.kcrash (4.13 KB, text/plain)
2014-01-09 20:44 UTC, Robert s.
Details
short demonstration of [probably] related selection bug (825.20 KB, video/ogg)
2014-07-21 02:07 UTC, kdebugs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert s. 2013-12-29 18:06:55 UTC
I have moved files and folders with the help of the ctrl and shift key, when I was done behaved dolphin still as if I pressed the Ctrl or Shift key.
new start of dolphin solves the problem

Reproducible: Couldn't Reproduce
Comment 1 Frank Reininghaus 2014-01-03 17:30:20 UTC
Thanks for the bug report, but I cannot reproduce the problem.

Could you please describe in detail what steps can be used to reproduce the buggy behavior, and in how far Dolphin behaves "still as if I pressed the Ctrl or Shift key"?

Thanks for your help.
Comment 2 Robert s. 2014-01-04 15:07:26 UTC
Today i worked in Dolphin and the error came again.
I changed a Directory and all Folders above get marked without pressing anything.
The only solution is closing dolphin.

look here:

https://www.dropbox.com/s/otcbct56krf2z6u/20140104_155656.mp4

I can not reproduce the error
Comment 3 Robert s. 2014-01-04 15:09:17 UTC
the only thing i´ve done in Dolphin is doing many copy and paste operations.
Comment 4 Frank Reininghaus 2014-01-06 19:29:19 UTC
Thanks for the update and the video. I assume that you pressed the left mouse button while hovering the expansion toggles (">"). It's strange indeed that items get selected then. I have never seen such a problem myself, and I currently have no idea why that could happen. BTW, items never get selected for me even if Shift is pressed while clicking a ">", so I'm slightly confused by your bug description. Maybe you use some non-default settings? Do you use single-click or double-click activation?

(In reply to comment #2)
> I can not reproduce the error

It would be great if you could try to find a series of steps that can be used to reproduce the problem. Otherwise, there is little hope that the problem can be fixed.
Comment 5 Robert s. 2014-01-09 19:23:47 UTC
today i reinstalled opensuse, after three hours work with many copy & paste actions the error came again, i don´t understand why. all settings in kde & dolphin are standard.

i tried to reproduce the error, but no luck
Comment 6 Robert s. 2014-01-09 20:44:36 UTC
Created attachment 84540 [details]
dolphin-20140109-213035.kcrash

now i startet dolphin from the terminal, after some copy & paste & renaming, Dolphin Crash.
I uploaded the log file, perhaps it´s helpfull.
Comment 7 Robert s. 2014-01-09 20:47:01 UTC
(In reply to comment #6)
> Created attachment 84540 [details]
> dolphin-20140109-213035.kcrash
> 
> now i startet dolphin from the terminal, after some copy & paste & renaming,
> Dolphin Crash.
> I uploaded the log file, perhaps it´s helpfull.

the terminal error message:

vomxx@linux-wocj:~> dolphin
Object::connect: No such signal org::freedesktop::UPower::DeviceAdded(QDBusObjectPath)
Object::connect: No such signal org::freedesktop::UPower::DeviceRemoved(QDBusObjectPath)
dolphin(16943) KSambaSharePrivate::testparmParamValue: We got some errors while running testparm "Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
ERROR: pid directory /var/run/samba does not exist
" 
dolphin(16943) KDesktopFile::isAuthorizedDesktopFile: Access to ' "/home/vomit/Schreibtisch/zsnes.desktop" ' denied, not owned by root, executable flag not set. 

dolphin(16943)/kio (KDirListerCache) KDirListerCache::emitItemsFromCache: Can't find item for directory "file:///home/vomit/Downloads/extracted/thecrystamet.../The%20Crystal%20Method%20-%20The%20Crystal%20Method%20(2014)" anymore 
KCrash: Application 'dolphin' crashing...
KCrash: Attempting to start /usr/lib64/kde4/libexec/drkonqi from kdeinit
sock_file=/home/vomit/.kde4/socket-linux-wocj/kdeinit4__0

[1]+  Angehalten              dolphin
Comment 8 Frank Reininghaus 2014-01-11 14:59:33 UTC
Please never report unrelated problems (like this crash) in existing bug reports. It makes the report much harder to read. (BTW, the report is not very useful because you don't have debug packages installed. The crash report dialog should have told you that.)
Comment 9 Frank Reininghaus 2014-02-04 09:13:00 UTC
Possibly related: bug 330736 ("In details view, select a few folders in the current folder, either by dragging over them, or by selecting one and using shift+arrow keys.  (Don't select the first listed folder.)  Now, click the ">" at the left of one of the selected folders.  Now, suddenly, all the folders above the folders you selected are now selected, too.").
Comment 10 Frank Reininghaus 2014-02-05 11:52:52 UTC
I looked again at the video and noticed that the expanded folder becomes the current item (i.e., it is underlined) for a short moment. Then the first item becomes the current item, and all items between those two get selected.

I then looked at the parts of the source code that can change the current item. I think that the problem is caused by the line

selectionManager->setCurrentItem(0);

in

DolphinView::updateViewState()

Then I could figure out some steps which made the problem reproducible for me:

1. mkdir test && cd test
2. mkdir a b c d e f f/1 g
3. dolphin . &
4. In Dolphin, press F3 to split the view.
5. Press "Down" to select "b".
6. Click on any "Place" in the Places Panel.
7. In the shell, rmdir b
8. In Dolphin, click "Back"
9. In Dolphin, expand the folder "f" by clicking on the arrow next to its icon.
10. Note that all items between "a" and "f" are selected.

The problem is that in step 8, Dolphin will try to make "b" the current item again, but "b" does not exist any more. DolphinView still keeps it in m_currentItemUrl though, and after expanding a folder and receiving the model's directoryLoadingCompleted() signal after the new items have been added, DolphinView::updateViewState() will notice again that "b" cannot be found and makes 0 the current index.

I'm not quite sure what the cleanest solution is. Calling

KItemListSelectionManager::endAnchoredSelection()

before changing the current item would at least prevent the selection of all items between the expanded folder and the top of the view. Removing "selectionManager->setCurrentItem(0);" would also prevent this - I'm not quite sure right now why that line was added at all.

However, this would still not fix the problem that the item "b" remains in m_currentItemUrl, and this might cause other subtle problems in the future.

Note that we always cleared m_currentItemUrl in DolphinView::upadteViewState() at some point. This was changed in https://git.reviewboard.kde.org/r/109950/ , which was about making Dolphin scroll to newly pasted files. The problem is that not all files might be pasted at the same time if the files are large, such that updateViewState() might be called several times before all items are there. But since we only make the first pasted item the "current" one anyway, maybe it doesn't matter if m_currentItemUrl is cleared, but I'm not sure, and I don't have much time now for further investigations.

This needs further thought to prevent that we introduce new problems by fixing this one.

In any case, thanks again for the video because watching it closely provided a very important hint for finding the root cause of the problem.
Comment 11 Marcelo Sales 2014-06-16 21:19:00 UTC
I got a problem here that is very likely related to this bug. After renaming several files using copy & paste operations (because the files have part of their names in common), everytime I rename a new file and press ENTER, all files in that folder, from the first until the one which was just renamed,  are automatically selected (?!). The files listed after the renamed one are not selected. 
My copy & paste operations were on the file names only, no actual files or folders were copied or pasted. I use CTRL+INS and SHIFT+INS to copy & paste and I'm renaming the files using F2 with inline renaming on. KDE/Dolphin are configured to select files with one click and open them with a double-click.
Only the Dolphin window where I was renaming files with copy & paste behaves like that. Other Dolphin windows that were already opened don't show this behavior, nor new Dolphin windows I open after that. The misbehaving window, however, remains that way until it is closed.
And something else: on the misbehaving window, only renaming operations on files within the folder where the problem showed up cause the files to be selected. If I switch to another folder in the same window, I can rename files there with no problem at all. Then if I return to the previous folder, the problem comes back again.
I am now running Kubuntu 14.04 with KDE 4.13.0, but the problem was already present before I upgraded from Kubuntu 12.10 (don't remember what version of KDE I was running then).
If you need more info, please ask.
Comment 12 Frank Reininghaus 2014-07-12 17:17:45 UTC
*** Bug 337393 has been marked as a duplicate of this bug. ***
Comment 13 kdebugs 2014-07-21 02:07:03 UTC
Created attachment 87844 [details]
short demonstration of [probably] related selection bug

The problem I'm noticing is probably related.  I don't know how to reproduce, but sometimes the selection just goes crazy.  It continues to affect the dolphin window until it is closed and doesn't depend on location, file system, etc.  The two triggers that select other files seem to be: 1) when files are added/removed from the current directory and 2) when expanding a folder in details mode.  Affects all three modes.  As you can see from the video clip, it DOES make a difference whether there is a currently selected file.

re: comment 2 - the dropbox link seems broken - maybe Robert can upload here if it isn't too big and he still has a copy.
Comment 14 Frank Reininghaus 2014-08-12 07:22:20 UTC
Git commit 1c9a92dae03a43e480d19230d9ea74fa528292b4 by Frank Reininghaus.
Committed on 12/08/2014 at 07:17.
Pushed by freininghaus into branch 'KDE/4.14'.

Always clear DolphinView's m_currentItemUrl member in updateViewState()

Before this patch, we still kept the URL in m_currentItemUrl if the URL
was not found in the model. This could cause problems the next time
updateViewState() was called, because the current index would then be
set to 0, which could cause other issues.

For example, all items between the first item in the view and a folder
which was expanded in Details View could be selected.

In principle, it is possible that updateViewState() is called multiple
times if many large files are being pasted in the view, but since the
item which should be made the current item (and which the view should
be scrolled to) should always be the first pasted item, this change
will most likely not cause any other problems.
REVIEW: 119703
FIXED-IN: 4.14.0

M  +2    -2    dolphin/src/views/dolphinview.cpp

http://commits.kde.org/kde-baseapps/1c9a92dae03a43e480d19230d9ea74fa528292b4
Comment 15 Emmanuel Pescosta 2014-08-23 14:12:51 UTC
*** Bug 338503 has been marked as a duplicate of this bug. ***
Comment 16 Frank Reininghaus 2014-09-08 16:30:15 UTC
*** Bug 338911 has been marked as a duplicate of this bug. ***
Comment 17 Frank Reininghaus 2015-07-23 17:17:45 UTC
*** Bug 350347 has been marked as a duplicate of this bug. ***
Comment 18 Frank Reininghaus 2015-08-09 16:03:58 UTC
*** Bug 349520 has been marked as a duplicate of this bug. ***