Skip to content
Permalink
Browse files
avoid detaching QSharedDataPointer<QgsMeshSpatialIndexData> (#45604)
  • Loading branch information
vcloarec committed Oct 21, 2021
1 parent 6c4b9d1 commit a7db0f230749b09ca7a5f5144e2f2aeec9e9487c
Showing with 12 additions and 6 deletions.
  1. +3 −0 src/core/mesh/qgsmeshlayerrenderer.cpp
  2. +4 −4 src/core/mesh/qgsmeshspatialindex.cpp
  3. +5 −2 src/core/mesh/qgstriangularmesh.cpp
@@ -428,6 +428,9 @@ void QgsMeshLayerRenderer::renderFaceMesh(
if ( context.renderingStopped() )
break;

if ( i >= faces.count() )
continue;

const QgsMeshFace &face = faces[i];
if ( face.size() < 2 )
continue;
@@ -409,11 +409,11 @@ void QgsMeshSpatialIndex::addFace( int faceIndex, const QgsMesh &mesh )
if ( !ok )
return;

const QMutexLocker locker( &d->mMutex );
const QMutexLocker locker( &d.constData()->mMutex );

try
{
d->mRTree->insertData( 0, nullptr, r, faceIndex );
d.constData()->mRTree->insertData( 0, nullptr, r, faceIndex );
}
catch ( Tools::Exception &e )
{
@@ -435,7 +435,7 @@ void QgsMeshSpatialIndex::removeFace( int faceIndex, const QgsMesh &mesh )
{
if ( mesh.face( faceIndex ).isEmpty() )
return;
const QMutexLocker locker( &d->mMutex );
const QMutexLocker locker( &d.constData()->mMutex );
bool ok = false;
d->mRTree->deleteData( faceToRegion( mesh, faceIndex, ok ), faceIndex );
d.constData()->mRTree->deleteData( faceToRegion( mesh, faceIndex, ok ), faceIndex );
}
@@ -639,8 +639,11 @@ static QSet<int> _nativeElementsFromElements( const QList<int> &indexes, const Q
QSet<int> nativeElements;
for ( const int index : indexes )
{
const int nativeIndex = elementToNativeElements[index];
nativeElements.insert( nativeIndex );
if ( index < elementToNativeElements.count() )
{
const int nativeIndex = elementToNativeElements[index];
nativeElements.insert( nativeIndex );
}
}
return nativeElements;
}

0 comments on commit a7db0f2

Please sign in to comment.