Skip to content

Commit 7a1fd93

Browse files
committedJul 6, 2017
Flush sink buffers instead of deleting sink/sources in processAlgorithm
Avoids potential issues if processAlgorithm is run in a different thread
1 parent e0c7daa commit 7a1fd93

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed
 

‎src/core/processing/qgsnativealgorithms.cpp‎

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ bool QgsCentroidAlgorithm::processAlgorithm( QgsProcessingContext &, QgsProcessi
134134
feedback->setProgress( current * step );
135135
current++;
136136
}
137-
mSource.reset();
138-
mSink.reset();
137+
mSink->flushBuffer();
139138
return true;
140139
}
141140

@@ -268,8 +267,7 @@ bool QgsBufferAlgorithm::processAlgorithm( QgsProcessingContext &, QgsProcessing
268267
mSink->addFeature( f, QgsFeatureSink::FastInsert );
269268
}
270269

271-
mSource.reset();
272-
mSink.reset();
270+
mSink->flushBuffer();
273271
return true;
274272
}
275273

@@ -427,9 +425,7 @@ bool QgsDissolveAlgorithm::processAlgorithm( QgsProcessingContext &, QgsProcessi
427425
}
428426
}
429427

430-
mSource.reset();
431-
mSink.reset();
432-
428+
mSink->flushBuffer();
433429
return true;
434430
}
435431

@@ -592,9 +588,7 @@ bool QgsClipAlgorithm::processAlgorithm( QgsProcessingContext &, QgsProcessingFe
592588
feedback->setProgress( 100.0 * static_cast< double >( i ) / clipGeoms.length() );
593589
}
594590
}
595-
mFeatureSource.reset();
596-
mMaskSource.reset();
597-
mSink.reset();
591+
mSink->flushBuffer();
598592
return true;
599593
}
600594

@@ -751,8 +745,7 @@ bool QgsSubdivideAlgorithm::processAlgorithm( QgsProcessingContext &, QgsProcess
751745
feedback->setProgress( current * step );
752746
current++;
753747
}
754-
mSource.reset();
755-
mSink.reset();
748+
mSink->flushBuffer();
756749
return true;
757750
}
758751

@@ -844,9 +837,7 @@ bool QgsMultipartToSinglepartAlgorithm::processAlgorithm( QgsProcessingContext &
844837
feedback->setProgress( current * step );
845838
current++;
846839
}
847-
mSource.reset();
848-
mSink.reset();
849-
840+
mSink->flushBuffer();
850841
return true;
851842
}
852843

@@ -968,10 +959,10 @@ bool QgsExtractByExpressionAlgorithm::processAlgorithm( QgsProcessingContext &,
968959
current++;
969960
}
970961
}
971-
972-
mSource.reset();
973-
mMatchingSink.reset();
974-
mNonMatchingSink.reset();
962+
if ( mMatchingSink )
963+
mMatchingSink->flushBuffer();
964+
if ( mNonMatchingSink )
965+
mNonMatchingSink->flushBuffer();
975966
return true;
976967
}
977968

@@ -1177,9 +1168,10 @@ bool QgsExtractByAttributeAlgorithm::processAlgorithm( QgsProcessingContext &, Q
11771168
}
11781169
}
11791170

1180-
mSource.reset();
1181-
mMatchingSink.reset();
1182-
mNonMatchingSink.reset();
1171+
if ( mMatchingSink )
1172+
mMatchingSink->flushBuffer();
1173+
if ( mNonMatchingSink )
1174+
mNonMatchingSink->flushBuffer();
11831175
return true;
11841176
}
11851177

0 commit comments

Comments
 (0)
Please sign in to comment.