#2939 ProgressInfo: Reintroduce process envents, to update the progress dialog durig processing on linux/mac.

Introduced isActive and used this info to block sheduled redraw/display model regen when progress bar is active, to avoid unintended recursive behaviour resulting in crashes.
This commit is contained in:
Jacob Støren
2018-05-21 23:46:35 +02:00
parent 2e9341c6d1
commit 9b9f9b2bf1
7 changed files with 106 additions and 19 deletions

View File

@@ -38,6 +38,7 @@
#include <QTreeView>
#include <set>
#include "cafProgressState.h"
//--------------------------------------------------------------------------------------------------
///
@@ -100,6 +101,12 @@ void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAnd
//--------------------------------------------------------------------------------------------------
void RiaCompletionTypeCalculationScheduler::slotRecalculateCompletionType()
{
if ( caf::ProgressState::isActive() )
{
startTimer();
return;
}
std::set<RimEclipseCase*> uniqueCases(m_eclipseCasesToRecalculate.begin(), m_eclipseCasesToRecalculate.end());
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();

View File

@@ -23,6 +23,7 @@
#include <QCoreApplication>
#include <set>
#include "cafProgressState.h"
//--------------------------------------------------------------------------------------------------
///
@@ -59,16 +60,24 @@ void RiaViewRedrawScheduler::scheduleDisplayModelUpdateAndRedraw(Rim3dView* resV
{
m_resViewsToUpdate.push_back(resViewToUpdate);
startTimer(0);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::startTimer(int msecs)
{
if (!m_resViewUpdateTimer)
{
m_resViewUpdateTimer = new QTimer(this);
connect(m_resViewUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateScheduledDisplayModels()));
connect(m_resViewUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateAndRedrawScheduledViewsWhenReady()));
}
if (!m_resViewUpdateTimer->isActive())
{
m_resViewUpdateTimer->setSingleShot(true);
m_resViewUpdateTimer->start(0);
m_resViewUpdateTimer->start(msecs);
}
}
@@ -76,7 +85,7 @@ void RiaViewRedrawScheduler::scheduleDisplayModelUpdateAndRedraw(Rim3dView* resV
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::slotUpdateScheduledDisplayModels()
void RiaViewRedrawScheduler::updateAndRedrawScheduledViews()
{
// Compress to remove duplicates
// and update dependent views after independent views
@@ -113,6 +122,20 @@ void RiaViewRedrawScheduler::slotUpdateScheduledDisplayModels()
m_resViewsToUpdate.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::slotUpdateAndRedrawScheduledViewsWhenReady()
{
if ( caf::ProgressState::isActive() )
{
startTimer(100);
return;
}
updateAndRedrawScheduledViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -33,11 +33,14 @@ public:
static RiaViewRedrawScheduler* instance();
void scheduleDisplayModelUpdateAndRedraw(Rim3dView* resViewToUpdate);
void clearViewsScheduledForUpdate();
void updateAndRedrawScheduledViews();
public slots:
void slotUpdateScheduledDisplayModels();
private slots:
void slotUpdateAndRedrawScheduledViewsWhenReady();
private:
void startTimer(int msecs);
RiaViewRedrawScheduler() : m_resViewUpdateTimer(nullptr) {}
~RiaViewRedrawScheduler();