As only the items in subdirectories of the renamed one are modified, if all the items are changed the same part of the path with the same new value, the order is preserved, therefore modify the path directly in the list.
BUG: 401552
dfaure |
Frameworks |
As only the items in subdirectories of the renamed one are modified, if all the items are changed the same part of the path with the same new value, the order is preserved, therefore modify the path directly in the list.
BUG: 401552
Can't reproduce the bug.
Passes kdirmodeltest and kdirlistertest (and many others).
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
autotests/kdirlistertest.cpp | ||
---|---|---|
1299–1308 | I was not able to reproduce the crash with the steps you described in https://phabricator.kde.org/D10742#377375. I can semi-reliably reproduce it by renaming a non-empty folder expanded in the dolphin detail view. |
I think this time I got the problem right.
One of the classics: I was modifying the list while it was being used.
src/core/kcoredirlister.cpp | ||
---|---|---|
1580 | Why is this modifying lstItems? That's a somewhat costly operation, if it's not needed. Why not a normal readonly iteration? |
There is no need for a unit test, it is already in kdirmodeltest (but perhaps could be expanded in another patch).
I've realized that it only modifies all paths of the subdirectories, and therefore if all the items of a sorted list change the same values, the order is preserved.
Please change the summary to something more descriptive. A bug number is pretty opaque in itself.
The patch itself looks good.
I also don't understand "kdirmodeltest tests this already". It passes for me, without this change.
I'll work on the unit test this weekend. I don't currently have enough free time on weekdays.
Added the unit test. It crashes for me every time without the patch and none with the patch.
autotests/kdirlistertest.cpp | ||
---|---|---|
1326 | What's drive_c? | |
1334 | This could be done before the previous line, and used there to remove some duplication? | |
1343 | Waiting for 0 signals doesn't really make sense, does it? I bet it works the same without the TRY_ | |
1346 | You could do the more compact and more informative QVERIFY2(job->exec(), qPrintable(job->errorString()); on line 1342, obviously, not here. |
Changes requested done and reduced code duplication.
autotests/kdirlistertest.cpp | ||
---|---|---|
1326 | I started this patch following the structure of .wine/drive_c ... |
With this version, the test with the patch applied is everlasting in:
while [ true ]; do bin/kdirlistertest testRenameDirectory; if [ $? -ne 0 ]; then break; fi; done
and is still crashing without the patch.