Skip to content

Commit 1cf5303

Browse files
committedJul 17, 2018
Fix race condition in stats summary dock
(cherry-picked from 4012109)
1 parent 98f3c62 commit 1cf5303

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed
 

‎src/app/qgsstatisticalsummarydockwidget.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ void QgsStatisticalSummaryDockWidget::gathererFinished()
235235

236236
void QgsStatisticalSummaryDockWidget::updateNumericStatistics()
237237
{
238-
if ( !mGatherer )
238+
QgsStatisticsValueGatherer *gatherer = qobject_cast<QgsStatisticsValueGatherer *>( QObject::sender() );
239+
// this may have been sent from a gathererer which was canceled previously and we don't care
240+
// about it anymore...
241+
if ( gatherer != mGatherer )
239242
return;
240243

241244
QList< QVariant > variantValues = mGatherer->values();
@@ -301,7 +304,10 @@ void QgsStatisticalSummaryDockWidget::updateNumericStatistics()
301304

302305
void QgsStatisticalSummaryDockWidget::updateStringStatistics()
303306
{
304-
if ( !mGatherer )
307+
QgsStatisticsValueGatherer *gatherer = qobject_cast<QgsStatisticsValueGatherer *>( QObject::sender() );
308+
// this may have been sent from a gathererer which was canceled previously and we don't care
309+
// about it anymore...
310+
if ( gatherer != mGatherer )
305311
return;
306312

307313
QVariantList values = mGatherer->values();
@@ -421,7 +427,10 @@ void QgsStatisticalSummaryDockWidget::layerSelectionChanged()
421427

422428
void QgsStatisticalSummaryDockWidget::updateDateTimeStatistics()
423429
{
424-
if ( !mGatherer )
430+
QgsStatisticsValueGatherer *gatherer = qobject_cast<QgsStatisticsValueGatherer *>( QObject::sender() );
431+
// this may have been sent from a gathererer which was canceled previously and we don't care
432+
// about it anymore...
433+
if ( gatherer != mGatherer )
425434
return;
426435

427436
QVariantList values = mGatherer->values();

0 commit comments

Comments
 (0)
Please sign in to comment.