diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 4b35a0248..e4dca2734 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -33,6 +33,9 @@ #include #include #include +#include + +Q_GLOBAL_STATIC_WITH_ARGS(QMutex, s_collatorMutex, (QMutex::Recursive)) // #define KFILEITEMMODEL_DEBUG @@ -1878,6 +1881,8 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const int KFileItemModel::stringCompare(const QString& a, const QString& b, const QCollator& collator) const { + QMutexLocker collatorLock(s_collatorMutex()); + if (m_naturalSorting) { return collator.compare(a, b); }