D23875: KCoreDirLister: fix crash when creating new folders from kfilewidget
Ahmad Samir
noreply at phabricator.kde.org
Wed Sep 11 18:10:25 BST 2019
ahmadsamir added a comment.
In D23875#529442 <https://phabricator.kde.org/D23875#529442>, @dhaumann wrote:
> Since this crash is in KCoreDirLister, I wonder whether we can find a unit test that reproduces this without the KFileWidget.
I think the main issue here is kdirlister inserting items into pendingUpdates, then trying to use an invalid, end(), iterator in DirItem::reinsert(); so it's about the pace things happen:
- with KFileWidget, the successive creating and entering of multiple nested folders puts things in pending updates; creating the nested folders in one go a/b/c/d (which is possible), doesn't cause the crash
- "Theoretically" with dolphin or gwenview, copying folders to a pen drive where presumably the latter is slow, so kdirlister is inserting items in pendingUpdates, the same with ripping an audio cd (these are slow by design it seems) and lastly copying files to a smart phone via kde-connect.
In D23875#529446 <https://phabricator.kde.org/D23875#529446>, @dhaumann wrote:
> A different patch was proposed with D21197 <https://phabricator.kde.org/D21197> in May 2019.
I didn't know about D21197 <https://phabricator.kde.org/D21197>, technically it's the same patch; from the other patch, I could be wrong but:
(*it).url() == oldUrl
will always be true, so it's redundant.
A couple of stuff I found while I was stuck^Wworking on this issue, (sharing them here because better minds than mine could have a better fix):
- It happens in slotResult() when the jobUrl is a //child// of an item dir in pendingUpdates
- The parentDir in reinsert() has DirItem->lstItems.size() == 0
When creating a new folder in the "save as" dialog, I see this sequence:
slotFilesAdded() -> itemsAddedInDirectory() -> updateDirectory(), in the latter checkUpdate(dir) is always false.
Using dolphin to create a new folder, then enter it, then create a new folder inside... etc, it's the same sequence but checkUpdate(dir) is usually always true. That confirms my idea that it's about pace, things happening too fast, or too slow in the case of the pen drive / audio cd / smart phone, and kdirlister is guarding against being flooded by FAM events.
REPOSITORY
R241 KIO
REVISION DETAIL
https://phabricator.kde.org/D23875
To: ahmadsamir, #frameworks, dfaure, chinmoyr
Cc: dhaumann, kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190911/3ae81dc4/attachment.html>
More information about the Kde-frameworks-devel
mailing list