Skip to content

Saved pre-init params not respected when loading project

When a project is loaded from a .txp file, devices get initialized with default pre-init params, even though different pre-init params were used and saved into the project.

Steps to reproduce: Create new project -> Initialize any plugin and a device (e.g. Anal testing plugin, Anal testing device), use distinctive values for pre-init params (e.g. Trace length = 555) -> Save project -> Load the same project again -> Plugin and device are initialized, but with incorrect params (default ones)

AFAIK this happens with any plugin/device.

I suspect this happens because of the duplicity in keeping params in TPluginUnitModel::m_postInitParam and TPluginUnitModel::m_unit::m_postInitParam.

I tried to play around with it, but I am unable to figure out the surrounding logic.

This is a potential hint :)

bool TPluginUnitModel::init() { 

if (!m_unit) return false;

// adding this condition initializes the pre-init params correctly
// when loading a saved project, but breaks normal deinit/init behaviour
if (!m_preInitParam.isEmpty()) 
{ m_unit->setPreInitParams(m_preInitParam); }

bool ok; 
m_unit->init(&ok);

if (ok) { m_wasInit = false; }

if (!m_postInitParam.isEmpty()) 
{ m_unit->setPostInitParams(m_postInitParam); }

return ok;

}