fix up crash caused by changes in object creation order and setting the state of the click IO object

This commit is contained in:
Paul Davis
2013-10-02 16:17:22 -04:00
parent c736d88a5f
commit 82f0f3a9a7
3 changed files with 13 additions and 11 deletions

View File

@@ -1619,6 +1619,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void setup_ltc ();
void setup_click ();
void setup_click_state (const XMLNode&);
void setup_bundles ();
static int get_session_info_from_path (XMLTree& state_tree, const std::string& xmlpath);

View File

@@ -592,14 +592,21 @@ Session::setup_ltc ()
void
Session::setup_click ()
{
XMLNode* child = 0;
_clicking = false;
_click_io.reset (new ClickIO (*this, "click"));
_click_gain.reset (new Amp (*this));
_click_gain->activate ();
if (state_tree && (child = find_named_node (*state_tree->root(), "Click")) != 0) {
if (state_tree) {
setup_click_state (*state_tree->root());
}
}
void
Session::setup_click_state (const XMLNode& node)
{
const XMLNode* child = 0;
if ((child = find_named_node (node, "Click")) != 0) {
/* existing state for Click */
int c = 0;

View File

@@ -1317,13 +1317,7 @@ Session::set_state (const XMLNode& node, int version)
if ((child = find_named_node (node, "Click")) == 0) {
warning << _("Session: XML state has no click section") << endmsg;
} else if (_click_io) {
const XMLNodeList& children (child->children());
XMLNodeList::const_iterator i = children.begin();
_click_io->set_state (**i, version);
++i;
if (i != children.end()) {
_click_gain->set_state (**i, version);
}
setup_click_state (node);
}
if ((child = find_named_node (node, ControlProtocolManager::state_node_name)) != 0) {