Ref T579 Work around proximate cause of data race in CListModelBase.

This is still not thread-safe but at least it is less likely to crash.
A more robust fix will be attempted later.
This commit is contained in:
Mat Sutcliffe
2019-04-02 13:47:36 +01:00
parent c4f26360de
commit 8fb0a009d1
2 changed files with 3 additions and 2 deletions

View File

@@ -545,10 +545,11 @@ namespace BlackGui
}
// sort the values
const auto tieBreakersCopy = m_sortTieBreakers; //! \todo workaround T579 still not thread-safe, but less likely to crash
const std::integral_constant<bool, UseCompare> marker {};
const auto p = [ = ](const ObjectType & a, const ObjectType & b) -> bool
{
return Private::compareForModelSort<ObjectType>(a, b, order, propertyIndex, m_sortTieBreakers, marker);
return Private::compareForModelSort<ObjectType>(a, b, order, propertyIndex, tieBreakersCopy, marker);
};
return container.sorted(p);

View File

@@ -165,7 +165,7 @@ namespace BlackGui
CColumns m_columns; //!< columns metadata
int m_sortColumn; //!< currently sorted column
bool m_modelDestroyed = false; //!< model is about to be destroyed
bool m_modelDestroyed = false; //!< \todo rudimentary workaround for T579, can be removed
Qt::SortOrder m_sortOrder; //!< sort order (asc/desc)
Qt::DropActions m_dropActions = Qt::IgnoreAction; //!< drop actions
BlackMisc::CPropertyIndexList m_sortTieBreakers; //!< how column values are sorted if equal, if no value is given this is random