Commit 06889180 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Minimize potential for nested progress events.

Fixes the logic to update incremental counters that avoid nested
progress events. Previous implementation had the potential for nested
events since it fired the events before updating internal counters.
Fixed that.
parent e227ca5f
......@@ -61,11 +61,10 @@ void vtkPVSession::PrepareProgress()
return;
}
if (this->ProgressCount == 0)
if (this->ProgressCount++ == 0)
{
this->PrepareProgressInternal();
}
this->ProgressCount++;
}
//----------------------------------------------------------------------------
......@@ -77,8 +76,7 @@ void vtkPVSession::CleanupPendingProgress()
}
this->InCleanupPendingProgress = true;
this->ProgressCount--;
if (this->ProgressCount == 0)
if (--this->ProgressCount == 0)
{
this->CleanupPendingProgressInternal();
}
......
......@@ -182,21 +182,19 @@ void pqProgressManager::setEnableProgress(bool enable)
if (enable)
{
if (this->ProgressCount == 0)
if (this->ProgressCount++ == 0)
{
this->EnableProgress = true;
emit this->enableProgress(true);
}
this->ProgressCount++;
}
else
{
if (this->ProgressCount == 1)
if (--this->ProgressCount == 0)
{
this->EnableProgress = false;
emit this->enableProgress(false);
}
this->ProgressCount--;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment