debug flag for session destruction and waf option for boost SP debug
[ardour.git] / libs / ardour / rc_configuration.cc
index ba9389eec854553730a1b418510052cbc2458d1d..e1876227572c0d3d1886fb7fce1b5fdfd561e57b 100644 (file)
@@ -90,14 +90,14 @@ RCConfiguration::load_state ()
                }
 
                if (statbuf.st_size != 0) {
-                       cerr << string_compose (_("Loading system configuration file %1"), rcfile) << endl;
+                       info << string_compose (_("Loading system configuration file %1"), rcfile) << endl;
 
                        if (!tree.read (rcfile.c_str())) {
                                error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg;
                                return -1;
                        }
 
-                       if (set_state (*tree.root())) {
+                       if (set_state (*tree.root(), Stateful::current_state_version)) {
                                error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
                                return -1;
                        }
@@ -125,14 +125,14 @@ RCConfiguration::load_state ()
                }
 
                if (statbuf.st_size != 0) {
-                       cerr << string_compose (_("Loading user configuration file %1"), rcfile) << endl;
+                       info << string_compose (_("Loading user configuration file %1"), rcfile) << endl;
 
                        if (!tree.read (rcfile)) {
                                error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg;
                                return -1;
                        }
 
-                       if (set_state (*tree.root())) {
+                       if (set_state (*tree.root(), Stateful::current_state_version)) {
                                error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
                                return -1;
                        }
@@ -200,11 +200,10 @@ RCConfiguration::get_state ()
 
        root = new XMLNode("Ardour");
 
-       MIDI::Manager::PortMap::const_iterator i;
-       const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
+       const MIDI::Manager::PortList& ports = MIDI::Manager::instance()->get_midi_ports();
 
-       for (i = ports.begin(); i != ports.end(); ++i) {
-               root->add_child_nocopy(i->second->get_state());
+       for (MIDI::Manager::PortList::const_iterator i = ports.begin(); i != ports.end(); ++i) {
+               root->add_child_nocopy((*i)->get_state());
        }
 
        root->add_child_nocopy (get_variables ());
@@ -240,7 +239,7 @@ RCConfiguration::get_variables ()
 }
 
 int
-RCConfiguration::set_state (const XMLNode& root)
+RCConfiguration::set_state (const XMLNode& root, int /*version*/)
 {
        if (root.name() != "Ardour") {
                return -1;
@@ -260,8 +259,11 @@ RCConfiguration::set_state (const XMLNode& root)
 
                                MIDI::Port::Descriptor desc (*node);
                                map<string,XMLNode>::iterator x;
+                               
                                if ((x = midi_ports.find (desc.tag)) != midi_ports.end()) {
-                                       midi_ports.erase (x);
+                                       warning << string_compose (_("Duplicate MIDI port definition found (tag=\"%1\") - ignored"),
+                                                                  desc.tag) << endmsg;
+                                       continue;
                                }
                                midi_ports.insert (pair<string,XMLNode>(desc.tag,*node));
                        }