Commit a36196fe authored by Marc R.'s avatar Marc R.

Merge branch...

Merge branch '212-trajectory-actor-crashes-on-session-load-if-data-source-not-available' into 'master'

Resolve "Trajectory actor crashes on session load if data source not available"

Closes #212

See merge request !198
parents 3fa5cc52 facc5adc
......@@ -1059,6 +1059,12 @@ void MTrajectoryActor::setDataSource(MTrajectoryDataSource *ds)
this, SLOT(asynchronousDataAvailable(MDataRequest)));
}
bool prevTrajectorySourceComputesInMet3D =
(dynamic_cast<MTrajectoryComputationSource*>(
trajectorySource) != nullptr);
bool newTrajectorySourceComputesInMet3D =
(dynamic_cast<MTrajectoryComputationSource*>(ds) != nullptr);
trajectorySource = ds;
if (trajectorySource != nullptr)
{
......@@ -1071,6 +1077,27 @@ void MTrajectoryActor::setDataSource(MTrajectoryDataSource *ds)
== nullptr);
updateActorData();
}
// Connect seed actors change signal to trajectory actor only if the new
// connected data source is a computation data source. If the data source
// is NO computation data source, the seed actors change signal should not
// trigger an update of the trajectory actor, hence disconnect signal.
if (!prevTrajectorySourceComputesInMet3D && newTrajectorySourceComputesInMet3D)
{
for (SeedActorSettings& sas : computationSeedActorProperties)
{
connect(sas.actor, SIGNAL(actorChanged()),
this, SLOT(onSeedActorChanged()));
}
}
else if (prevTrajectorySourceComputesInMet3D && !newTrajectorySourceComputesInMet3D)
{
for (SeedActorSettings& sas : computationSeedActorProperties)
{
disconnect(sas.actor, SIGNAL(actorChanged()),
this, SLOT(onSeedActorChanged()));
}
}
}
......@@ -2772,8 +2799,9 @@ void MTrajectoryActor::asynchronousDataRequest(bool synchronizationRequest)
// No computations necessary if trajectories are not displayed. (Besides
// data requests not needed lead to predefined trajectory actor not being
// displayed and system crash due to waiting for a unfinished thread at
// program end.)
if (getViews().size() == 0)
// program end.) Also no computations needed if actor is not connected to a
// data source.
if (getViews().size() == 0 || trajectorySource == nullptr)
{
return;
}
......@@ -3554,8 +3582,13 @@ void MTrajectoryActor::addSeedActor(
}
}
// Connect to actor changed signal.
connect(actor, SIGNAL(actorChanged()), this, SLOT(onSeedActorChanged()));
// Connect to actor changed signal but only if the trajectory data source
// is a computation data source. (Otherwise this connection would lead to
// unwanted recomputation requests).
if (dynamic_cast<MTrajectoryComputationSource*>(trajectorySource))
{
connect(actor, SIGNAL(actorChanged()), this, SLOT(onSeedActorChanged()));
}
// Create property group for this seed actor.
SeedActorSettings actorSettings;
......
......@@ -409,13 +409,13 @@ private:
QtProperty *computationIntegrationTimeProperty;
QtProperty *computationInterpolationMethodProperty;
QtProperty *computationLineTypeProperty;
QtProperty* computationIntegrationMethodProperty;
QtProperty *computationIntegrationMethodProperty;
QtProperty *computationNumSubTimeStepsProperty;
QtProperty *computationStreamlineDeltaSProperty;
QtProperty *computationStreamlineLengthProperty;
QtProperty* computationSeedPropertyGroup;
QtProperty* computationSeedAddActorProperty;
QtProperty* computationRecomputeProperty;
QtProperty *computationSeedPropertyGroup;
QtProperty *computationSeedAddActorProperty;
QtProperty *computationRecomputeProperty;
enum SeedActorType
{
......
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