Fix loading plugin state from sessions

While loading a session XML state, set_state must use
`Stateful::loading_state_version`.

When later copying processor state,
`Stateful::current_state_version` is correct.
This commit is contained in:
Robin Gareus 2019-12-11 16:21:23 +01:00
parent dd18be15fb
commit 0a5837ec71
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 13 additions and 13 deletions

View File

@ -409,8 +409,8 @@ public:
virtual int set_state (const XMLNode&, int version);
XMLNode& get_processor_state ();
void set_processor_state (const XMLNode&);
virtual bool set_processor_state (XMLNode const & node, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure);
void set_processor_state (const XMLNode&, int version);
virtual bool set_processor_state (XMLNode const & node, int version, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure);
boost::weak_ptr<Route> weakroute ();

View File

@ -65,7 +65,7 @@ public:
MeterState metering_state () const;
bool set_processor_state (XMLNode const & node, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure);
bool set_processor_state (XMLNode const& node, int version, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure);
bool declick_in_progress () const;

View File

@ -2691,7 +2691,7 @@ Route::set_state (const XMLNode& node, int version)
_initial_io_setup = false;
set_processor_state (processor_state);
set_processor_state (processor_state, version);
// this looks up the internal instrument in processors
reset_instrument_info();
@ -2988,7 +2988,7 @@ Route::set_processor_state_2X (XMLNodeList const & nList, int version)
}
void
Route::set_processor_state (const XMLNode& node)
Route::set_processor_state (const XMLNode& node, int version)
{
const XMLNodeList &nlist = node.children();
XMLNodeConstIterator niter;
@ -3037,7 +3037,7 @@ Route::set_processor_state (const XMLNode& node)
_disk_writer->set_state (**niter, Stateful::current_state_version);
new_order.push_back (_disk_writer);
} else {
set_processor_state (**niter, prop, new_order, must_configure);
set_processor_state (**niter, version, prop, new_order, must_configure);
}
}
@ -3096,14 +3096,14 @@ Route::set_processor_state (const XMLNode& node)
}
bool
Route::set_processor_state (XMLNode const & node, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure)
Route::set_processor_state (XMLNode const& node, int version, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure)
{
ProcessorList::iterator o;
for (o = _processors.begin(); o != _processors.end(); ++o) {
XMLProperty const * id_prop = node.property(X_("id"));
if (id_prop && (*o)->id() == id_prop->value()) {
(*o)->set_state (node, Stateful::current_state_version);
(*o)->set_state (node, version);
new_order.push_back (*o);
break;
}
@ -3149,7 +3149,7 @@ Route::set_processor_state (XMLNode const & node, XMLProperty const* prop, Proce
return false;
}
if (processor->set_state (node, Stateful::current_state_version) != 0) {
if (processor->set_state (node, version) != 0) {
/* This processor could not be configured. Turn it into a UnknownProcessor */
processor.reset (new UnknownProcessor (_session, node));
}

View File

@ -850,9 +850,9 @@ Track::metering_state () const
}
bool
Track::set_processor_state (XMLNode const & node, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure)
Track::set_processor_state (XMLNode const& node, int version, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure)
{
if (Route::set_processor_state (node, prop, new_order, must_configure)) {
if (Route::set_processor_state (node, version, prop, new_order, must_configure)) {
return true;
}
@ -860,13 +860,13 @@ Track::set_processor_state (XMLNode const & node, XMLProperty const* prop, Proce
if (prop->value() == "diskreader") {
if (_disk_reader) {
_disk_reader->set_state (node, Stateful::current_state_version);
_disk_reader->set_state (node, version);
new_order.push_back (_disk_reader);
return true;
}
} else if (prop->value() == "diskwriter") {
if (_disk_writer) {
_disk_writer->set_state (node, Stateful::current_state_version);
_disk_writer->set_state (node, version);
new_order.push_back (_disk_writer);
return true;
}