Skip to content

Commit

Permalink
Fixed some seemingly random crashes may occur (especially on Windows) (
Browse files Browse the repository at this point in the history
…closes #1574).
  • Loading branch information
agarny committed Apr 4, 2018
2 parents ad0e5eb + ab69a03 commit df6530d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion doc/downloads/index.js
Expand Up @@ -42,7 +42,7 @@ var jsonData = { "versions": [
{ "change": "<strong>CellML support:</strong> now provide more information when imports cannot be fully instantiated (see issue <a href=\"https://github.com/opencor/opencor/issues/1595\">#1595</a>)." },
{ "change": "<strong>SED-ML support:</strong> fixed a problem with OpenCOR crashing when saving an empty SED-ML file (see issue <a href=\"https://github.com/opencor/opencor/issues/1572\">#1572</a>)." },
{ "change": "<strong>PMR Workspaces window:</strong> fixed a problem that resulted in the the window being empty until reauthentication (see issue <a href=\"https://github.com/opencor/opencor/issues/1581\">#1581</a>)." },
{ "change": "<strong>Simulation Experiment view:</strong> prevent a model with no ODEs/DAEs from crashing OpenCOR (see issue <a href=\"https://github.com/opencor/opencor/issues/1576\">#1576</a>)." },
{ "change": "<strong>Simulation Experiment view:</strong> fixed some seemingly random crashes (especially on Windows; see issue <a href=\"https://github.com/opencor/opencor/issues/1574\">#1574</a>). Prevent a model with no ODEs/DAEs from crashing OpenCOR (see issue <a href=\"https://github.com/opencor/opencor/issues/1576\">#1576</a>)." },
{ "change": "<strong>Third-party libraries:</strong> have libgit2 use our copy of zlib rather than the one provided by the system (see issue <a href=\"https://github.com/opencor/opencor/issues/1577\">#1577</a>). Upgraded <a href=\"https://libgit2.github.com/\">libgit2</a> to version 0.27.0 (see issue <a href=\"https://github.com/opencor/opencor/issues/1588\">#1588</a>). Upgraded <a href=\"https://www.openssl.org/\">OpenSSL</a> to version 1.0.2o (see issue <a href=\"https://github.com/opencor/opencor/issues/1589\">#1589</a>)." }
]
},
Expand Down
Expand Up @@ -516,6 +516,11 @@ QStringList PmrWorkspacesWindowSynchronizeDialog::fileNames() const

void PmrWorkspacesWindowSynchronizeDialog::refreshChanges()
{
// Refresh our changes, but only if we are visible

if (!isVisible())
return;

// Keep track of our existing items

PmrWorkspacesWindowSynchronizeDialogItems oldItems = PmrWorkspacesWindowSynchronizeDialogItems();
Expand Down
Expand Up @@ -1387,7 +1387,10 @@ void PmrWorkspacesWindowWidget::duplicateCloneMessage(const QString &pUrl,

void PmrWorkspacesWindowWidget::refreshWorkspaces()
{
// Refresh our workspaces
// Refresh our workspaces, but only if we are visible

if (!isVisible())
return;

PMRSupport::PmrWorkspaces workspaces = PMRSupport::PmrWorkspaceManager::instance()->workspaces();
int workspacesCount = workspaces.count();
Expand Down
Expand Up @@ -222,7 +222,7 @@ void SimulationExperimentViewPlugin::pluginsInitialized(const Plugins &pLoadedPl
mViewWidget->setObjectName("SimulationExperimentViewWidget");

// Hide our Simulation Experiment view widget since it may not initially be
// shown in our central widget
// shown in our central widget

mViewWidget->hide();
}
Expand Down
Expand Up @@ -71,7 +71,8 @@ SimulationExperimentViewWidget::SimulationExperimentViewWidget(SimulationExperim
mSimulationWidgets(QMap<QString, SimulationExperimentViewSimulationWidget *>()),
mFileNames(QStringList()),
mSimulationResultsSizes(QMap<QString, quint64>()),
mSimulationCheckResults(QStringList())
mSimulationCheckResults(QStringList()),
mNeedReloading(QStringList())
{
}

Expand Down Expand Up @@ -221,7 +222,13 @@ void SimulationExperimentViewWidget::initialize(const QString &pFileName)
this, &SimulationExperimentViewWidget::graphsSettingsRequested);
} else {
// We already have a simulation widget, so just make sure that its GUI
// is up to date
// is up to date, after having reloaded our file, if needed

if (mNeedReloading.contains(pFileName)) {
mNeedReloading.removeOne(pFileName);

mSimulationWidget->fileReloaded();
}

mSimulationWidget->updateGui();
}
Expand Down Expand Up @@ -353,26 +360,11 @@ void SimulationExperimentViewWidget::fileSaved(const QString &pFileName)

void SimulationExperimentViewWidget::fileReloaded(const QString &pFileName)
{
// Let the simulation widget, if any, associated with the given file name
// know that a file has been reloaded
// Keep track of the fact that we will need to reload ourselves the next
// time we will be initialised

SimulationExperimentViewSimulationWidget *simulationWidget = mSimulationWidgets.value(pFileName);

if (simulationWidget) {
simulationWidget->fileReloaded();

// Make sure that our simulation's contents' information GUI is up to
// date
// Note: this is, at least, necessary for our paramaters widget since we
// repopulate it, meaning that its columns' width will be reset...

updateContentsInformationGui(simulationWidget);

// Make sure that the GUI of our simulation widgets is up to date

foreach (SimulationExperimentViewSimulationWidget *simulationWidget, mSimulationWidgets)
simulationWidget->updateGui(true);
}
if (!mNeedReloading.contains(pFileName))
mNeedReloading << pFileName;
}

//==============================================================================
Expand Down
Expand Up @@ -130,6 +130,8 @@ class SimulationExperimentViewWidget : public Core::ViewWidget
QMap<QString, quint64> mSimulationResultsSizes;
QStringList mSimulationCheckResults;

QStringList mNeedReloading;

void updateContentsInformationGui(SimulationExperimentViewSimulationWidget *pSimulationWidget);

private slots:
Expand Down

0 comments on commit df6530d

Please sign in to comment.