StartLiveData - crash in custom interface


I have a custom interface that executes the StartLiveData algorithm. This creates and populates a table workspace fine. Right clicking on the workspace in Mantid and deleting the workspace while the live data algorithm is running results in a crash. Nothing else is accessing the workspace.

When I manually start the Live Data Monitoring from within MantidPlot I can delete the workspace with the listener is running and a new workspace is created on the next update.

How can I replicate this behaviour?



Sample code:

auto & am = M::API::AlgorithmManager::Instance();
auto sld_alg = am.create(“StartLiveData”, -1, true);

sld_alg->setPropertyValue( “Instrument”, instrument_name );
sld_alg->setPropertyValue( “UpdateEvery”, str_update );
sld_alg->setPropertyValue(“AccumulationMethod”, “Replace” );
sld_alg->setProperty(“PreserveEvents”, false);
sld_alg->setPropertyValue(“OutputWorkspace”, instrument_name );

auto mld_alg = sld_alg->getProperty( “MonitorLiveData” );

_AlgMap[ instrument_name ] = mld_alg;

So StartLiveData starts the process, but it creates another algorithm MonitorLiveData in the background. If you want to cancel the live stream then you need to cancel that algorithm that is running in the background.

There is an example here that shows how to do that in python.

Nick Draper