D13814: Speedup sort

Mark Gaiser noreply at phabricator.kde.org
Sun Jul 8 11:00:03 BST 2018


markg added a comment.


  Somehow i'm inclined to think that m_collator is wrong.
  But inspecting the code shows no issue as far as i can tell. It's a normal class member that lives as long as the KFileItemModel instance lives.
  
  Now here's a tricky part. KFileItemModel is new'ed for each view (and the folders panel) and as the sorting is (for strings) done with multiple threads.
  Perhaps there is a remote possibility of closing a view while sorting which will cause the lessThan lambda to have a dangling reference to m_collator and crash.
  
  That's just in theory though, i haven't been able to reproduce that. 
  But if that is true then you do have ways to create that dangling reference and thus crash while sorting.

INLINE COMMENTS

> kfileitemmodel.cpp:112
> +    // warm up the collator so it does not has thread safety problems later
> +    m_collator.compare(QStringLiteral("aaaaaaaaaaaaaaaaaaaa"), QStringLiteral("bbbbbbbbbbbbbbbbbbbbbb"));
>  }

I don't know what @elvisangelaccio thinks about this, but i'm against it. This feels like a hacky workaround to me that should not be needed.

REPOSITORY
  R318 Dolphin

REVISION DETAIL
  https://phabricator.kde.org/D13814

To: jtamate, #dolphin, #frameworks, markg, elvisangelaccio
Cc: elvisangelaccio, apol, bruns, markg, kfm-devel, spoorun, navarromorales, firef, andrebarros, emmanuelp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180708/91591eff/attachment.htm>


More information about the kfm-devel mailing list