Skip to content

Commit 21c5eaf

Browse files
committed
Prevent tasks from spamming progress reports
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)
1 parent b67d661 commit 21c5eaf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/qgstaskmanager.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,11 @@ void QgsTask::setProgress( double progress )
212212
progress = ( progress + totalProgress ) / ( mSubTasks.count() + 1 );
213213
}
214214

215+
// avoid flooding with too many events
216+
if ( static_cast< int >( mTotalProgress * 10 ) != static_cast< int >( progress * 10 ) )
217+
emit progressChanged( progress );
218+
215219
mTotalProgress = progress;
216-
emit progressChanged( mTotalProgress );
217220
}
218221

219222
void QgsTask::completed()

0 commit comments

Comments
 (0)