Skip to content

Commit 44d7644

Browse files
committedMar 2, 2019
Never assume anything
because when you do, reality will teach you better
1 parent 9c49b8a commit 44d7644

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed
 

‎src/analysis/vector/geometry_checker/qgsfeaturepool.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ QgsFeaturePool::QgsFeaturePool( QgsVectorLayer *layer )
3838

3939
bool QgsFeaturePool::getFeature( QgsFeatureId id, QgsFeature &feature, QgsFeedback *feedback )
4040
{
41-
QgsReadWriteLocker locker( mCacheLock, QgsReadWriteLocker::Read );
41+
// Why is there a write lock acquired here? Weird, we only want to read a feature from the cache, right?
42+
// A method like `QCache::object(const Key &key) const` certainly would not modify its internals.
43+
// Mmmh. What if reality was different?
44+
// If one reads the docs very, very carefully one will find the term "reentrant" in the
45+
// small print of the QCache docs. This is the hint that reality is different.
46+
//
47+
// https://bugreports.qt.io/browse/QTBUG-19794
48+
49+
QgsReadWriteLocker locker( mCacheLock, QgsReadWriteLocker::Write );
4250
QgsFeature *cachedFeature = mFeatureCache.object( id );
4351
if ( cachedFeature )
4452
{

0 commit comments

Comments
 (0)
Please sign in to comment.