Skip to content

Commit

Permalink
Better assert messages
Browse files Browse the repository at this point in the history
Issues is actually when prepare/postProcess is called in a different
thread to context - it doesn't have to be the main thread
  • Loading branch information
nyalldawson committed Jul 6, 2017
1 parent 1b2086e commit 2543e07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/processing/qgsprocessingalgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ QVariantMap QgsProcessingAlgorithm::run( const QVariantMap &parameters, QgsProce

bool QgsProcessingAlgorithm::prepare( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
Q_ASSERT_X( QApplication::instance()->thread() == QThread::currentThread(), "QgsProcessingAlgorithm::prepare", "prepare() must be called from the main thread" );
Q_ASSERT_X( QApplication::instance()->thread() == 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 @@ -376,7 +376,7 @@ bool QgsProcessingAlgorithm::runPrepared( QgsProcessingContext &context, QgsProc

QVariantMap QgsProcessingAlgorithm::postProcess( QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
Q_ASSERT_X( QApplication::instance()->thread() == QThread::currentThread(), "QgsProcessingAlgorithm::postProcess", "postProcess() must be called from the main thread" );
Q_ASSERT_X( QApplication::instance()->thread() == context.temporaryLayerStore()->thread(), "QgsProcessingAlgorithm::postProcess", "postProcess() must be called from the same thread the context was created in" );
Q_ASSERT_X( mHasExecuted, "QgsProcessingAlgorithm::postProcess", "runPrepared() was not called for the algorithm instance" );
Q_ASSERT_X( !mHasPostProcessed, "QgsProcessingAlgorithm::postProcess", "postProcess() was already called for this algorithm instance" );

Expand Down

0 comments on commit 2543e07

Please sign in to comment.