Skip to content

Commit

Permalink
Prevent tasks from spamming progress reports
Browse files Browse the repository at this point in the history
Doing so grinds the QGIS to a halt, yet often progress
reports are being sent every feature (which results
in thousands of 0.00001 progress increment reports
for large layers!!)

(cherry-picked from 8961ac4)
  • Loading branch information
nyalldawson committed May 3, 2018
1 parent b67d661 commit 21c5eaf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/qgstaskmanager.cpp
Expand Up @@ -212,8 +212,11 @@ void QgsTask::setProgress( double progress )
progress = ( progress + totalProgress ) / ( mSubTasks.count() + 1 );
}

// avoid flooding with too many events
if ( static_cast< int >( mTotalProgress * 10 ) != static_cast< int >( progress * 10 ) )
emit progressChanged( progress );

mTotalProgress = progress;
emit progressChanged( mTotalProgress );
}

void QgsTask::completed()
Expand Down

0 comments on commit 21c5eaf

Please sign in to comment.