Skip to content

Commit

Permalink
Avoid some false positive assertWithSideEffect warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 15, 2023
1 parent eda48ee commit 58128ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/processing/qgsprocessingalgorithm.cpp
Expand Up @@ -562,6 +562,7 @@ QVariantMap QgsProcessingAlgorithm::run( const QVariantMap &parameters, QgsProce

bool QgsProcessingAlgorithm::prepare( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
// cppcheck-suppress assertWithSideEffect
Q_ASSERT_X( QThread::currentThread() == context.temporaryLayerStore()->thread(), "QgsProcessingAlgorithm::prepare", "prepare() must be called from the same thread as context was created in" );
Q_ASSERT_X( !mHasPrepared, "QgsProcessingAlgorithm::prepare", "prepare() has already been called for the algorithm instance" );
try
Expand Down Expand Up @@ -635,6 +636,7 @@ QVariantMap QgsProcessingAlgorithm::runPrepared( const QVariantMap &parameters,

QVariantMap QgsProcessingAlgorithm::postProcess( QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
// cppcheck-suppress assertWithSideEffect
Q_ASSERT_X( QThread::currentThread() == context.temporaryLayerStore()->thread(), "QgsProcessingAlgorithm::postProcess", "postProcess() must be called from the same thread the context was created in" );
Q_ASSERT_X( mHasExecuted, "QgsProcessingAlgorithm::postProcess", QStringLiteral( "algorithm instance %1 was not executed" ).arg( name() ).toLatin1() );
Q_ASSERT_X( !mHasPostProcessed, "QgsProcessingAlgorithm::postProcess", "postProcess() was already called for this algorithm instance" );
Expand Down
1 change: 1 addition & 0 deletions src/core/vector/qgsvectorlayereditbuffer.cpp
Expand Up @@ -771,6 +771,7 @@ bool QgsVectorLayerEditBuffer::commitChangesChangeAttributes( bool &attributesCh

if ( L->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeFeatures && !mChangedGeometries.isEmpty() && !mChangedAttributeValues.isEmpty() )
{
// cppcheck-suppress assertWithSideEffect
Q_ASSERT( ( L->dataProvider()->capabilities() & ( QgsVectorDataProvider::ChangeAttributeValues | QgsVectorDataProvider::ChangeGeometries ) ) == ( QgsVectorDataProvider::ChangeAttributeValues | QgsVectorDataProvider::ChangeGeometries ) );

if ( L->dataProvider()->changeFeatures( mChangedAttributeValues, mChangedGeometries ) )
Expand Down

0 comments on commit 58128ce

Please sign in to comment.