fixes for various bugs including dangling ref to route in session, opening sessions...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 2 Oct 2006 18:09:34 +0000 (18:09 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 2 Oct 2006 18:09:34 +0000 (18:09 +0000)
git-svn-id: svn://localhost/ardour2/trunk@938 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/actions.cc
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_region_list.cc
libs/ardour/ardour/session.h
libs/ardour/audio_diskstream.cc
libs/ardour/audiofilesource.cc
libs/ardour/session.cc

index 8aa8ed0cbb9892315cb9be4c6885b85606d2a7f9..885a23ffc75cb3c0d39f3973536bc07ddc6d9300 100644 (file)
@@ -294,8 +294,6 @@ ActionManager::toggle_config_state (const char* group, const char* action, bool
                if (tact) {
                        bool x = (Config->*get)();
 
-                       cerr << "\ttoggle config, action = " << tact->get_active() << " config = " << x << endl;
-                       
                        if (x != tact->get_active()) {
                                (Config->*set) (!x);
                        }
@@ -326,13 +324,11 @@ ActionManager::map_some_state (const char* group, const char* action, bool (Conf
                        
                        bool x = (Config->*get)();
 
-                       cerr << "\tmap state, action = " << tact->get_active() << " config = " << x << endl;
-                       
                        if (tact->get_active() != x) {
                                tact->set_active (x);
                        }
                } else {
-                       cerr << "not a toggle\n";
+                       cerr << group << ':' << action << " is not a toggle\n";
                }
        } else {
                cerr << group << ':' << action << " not an action\n";
index 701c69c99653667f9ebe4a79a52e246d1a8483de..97d5c81b287935e49aa2d534e1205d3114a4dc4d 100644 (file)
@@ -1629,6 +1629,7 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
        do {
                response = new_session_dialog->run ();
                //nsd_window ->set_cursor(Gdk::Cursor(Gdk::WATCH));
+
                if(response == Gtk::RESPONSE_CANCEL || response == Gtk::RESPONSE_DELETE_EVENT) {
                        quit();
                        return;
@@ -1645,7 +1646,6 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
                        
                        if (session_name.empty()) {
                                response = Gtk::RESPONSE_NONE;
-                               cerr << "session name is empty\n";
                                continue;
                        } 
 
@@ -1660,6 +1660,8 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
                        
                } else if (response == Gtk::RESPONSE_OK) {
 
+                       session_name = new_session_dialog->session_name();
+                       
                        if (new_session_dialog->get_current_page() == 1) {
                  
                                /* XXX this is a bit of a hack.. 
@@ -1670,7 +1672,6 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
                                
                                if (session_name.empty()) {
                                        response = Gtk::RESPONSE_NONE;
-                                       cerr << "session name is empty 2\n";
                                        continue;
                                } 
                                
@@ -1687,11 +1688,8 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
 
                                _session_is_new = true;
                              
-                               session_name = new_session_dialog->session_name();
-                       
                                if (session_name.empty()) {
                                        response = Gtk::RESPONSE_NONE;
-                                       cerr << "session name is empty 3\n";
                                        continue;
                                } 
 
index 7a3ebfc13059495418743260e2f4a801a44d3fc1..64f4dcfc855b52bde79e2bde7c3962db94a72dd2 100644 (file)
@@ -747,8 +747,6 @@ ARDOUR_UI::set_meter_falloff (MeterFalloff val)
 void
 ARDOUR_UI::parameter_changed (const char* parameter_name)
 {
-       cerr << "Parameter changed : " << parameter_name << endl;
-
 #define PARAM_IS(x) (!strcmp (parameter_name, (x)))
 
        if (PARAM_IS ("slave-source")) {
index b36e4ff7f91fb7350dbbd49a3aedc2ea1e028de3..6fb895004738b3dc80e8fda2cf274be107d3203c 100644 (file)
@@ -816,7 +816,7 @@ Editor::parameter_changed (const char* parameter_name)
        } else if (PARAM_IS ("crossfades-visible")) {
                ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_crossfades_visible);
        } else if (PARAM_IS ("auto-xfade")) {
-               ActionManager::map_some_state ("Editor", "toggle-auto-xfade", &Configuration::get_auto_xfade);
+               ActionManager::map_some_state ("Editor", "toggle-auto-xfades", &Configuration::get_auto_xfade);
        } else if (PARAM_IS ("edit-mode")) {
                edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
        }
index 31215e47a62d5f0fb5ef72b6ec9f97ad593c586e..397c401e0cadf51910976fef27ba981149aa77b6 100644 (file)
@@ -235,6 +235,7 @@ Editor::redisplay_regions ()
                for (list<boost::shared_ptr<AudioRegion> >::iterator r = tmp_audio_region_list.begin(); r != tmp_audio_region_list.end(); ++r) {
                        add_audio_region_to_region_display (*r);
                }
+               tmp_audio_region_list.clear();
                
                region_list_display.set_model (region_list_model);
        }
index f6d5e9cc8d2f2d6d2e1be4f3cd7b513fe18cb251..79fd4429958cb1f13f8b269e00d32d5de98227da 100644 (file)
@@ -1419,7 +1419,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible
        bool       currently_soloing;
        
        void route_mute_changed (void *src);
-       void route_solo_changed (void *src, boost::shared_ptr<Route>);
+       void route_solo_changed (void *src, boost::weak_ptr<Route>);
        void catch_up_on_solo ();
        void update_route_solo_state ();
        void modify_solo_mute (bool, bool);
index 71d16583e00f1cf9945e2eda060e55eaa11a793c..89bffc89e3f8004f03ac7e24a6ccf45f3e2cc3dc 100644 (file)
@@ -1967,8 +1967,6 @@ AudioDiskstream::reset_write_sources (bool mark_write_complete, bool force)
        ChannelList::iterator chan;
        uint32_t n;
 
-       cerr << _name << " RWS\n";
-
        if (!recordable()) {
                return;
        }
index dfc07de78795f1ba64783c9c4f0ab9e21bfa4236..9564fff53b79b6bf7183caf7907ec9f423b320a3 100644 (file)
@@ -101,7 +101,6 @@ AudioFileSource::AudioFileSource (Session& s, const XMLNode& node)
 AudioFileSource::~AudioFileSource ()
 {
        if (removable()) {
-               cerr << "Removing file " << _path << " because its removable\n";
                unlink (_path.c_str());
                unlink (peakpath.c_str());
        }
index 057774b49c036bf72c105aa34da2c5b9e166aace..bf5f5fcb781cb673e172418fddb970d11aa5685a 100644 (file)
@@ -1825,7 +1825,10 @@ Session::add_routes (RouteList& new_routes, bool save)
        }
 
        for (RouteList::iterator x = new_routes.begin(); x != new_routes.end(); ++x) {
-               (*x)->solo_changed.connect (sigc::bind (mem_fun (*this, &Session::route_solo_changed), (*x)));
+               
+               boost::weak_ptr<Route> wpr (*x);
+
+               (*x)->solo_changed.connect (sigc::bind (mem_fun (*this, &Session::route_solo_changed), wpr));
                (*x)->mute_changed.connect (mem_fun (*this, &Session::route_mute_changed));
                (*x)->output_changed.connect (mem_fun (*this, &Session::set_worst_io_latencies_x));
                (*x)->redirects_changed.connect (mem_fun (*this, &Session::update_latency_compensation_proxy));
@@ -1883,11 +1886,11 @@ Session::remove_route (shared_ptr<Route> route)
                */
 
                if (route == _master_out) {
-                       _master_out = shared_ptr<Route> ((Route*) 0);
+                       _master_out = shared_ptr<Route> ();
                }
 
                if (route == _control_out) {
-                       _control_out = shared_ptr<Route> ((Route*) 0);
+                       _control_out = shared_ptr<Route> ();
 
                        /* cancel control outs for all routes */
 
@@ -1925,13 +1928,21 @@ Session::remove_route (shared_ptr<Route> route)
        update_latency_compensation (false, false);
        set_dirty();
        
-       /* XXX should we disconnect from the Route's signals ? */
+       /* get rid of it from the dead wood collection in the route list manager */
+
+       /* XXX i think this is unsafe as it currently stands, but i am not sure. (pd, october 2nd, 2006) */
 
-       save_state (_current_snapshot_name);
+       routes.flush ();
 
        /* try to cause everyone to drop their references */
 
        route->drop_references ();
+
+       /* save the new state of the world */
+
+       if (save_state (_current_snapshot_name)) {
+               save_history (_current_snapshot_name);
+       }
 }      
 
 void
@@ -1941,7 +1952,7 @@ Session::route_mute_changed (void* src)
 }
 
 void
-Session::route_solo_changed (void* src, shared_ptr<Route> route)
+Session::route_solo_changed (void* src, boost::weak_ptr<Route> wpr)
 {      
        if (solo_update_disabled) {
                // We know already
@@ -1949,8 +1960,15 @@ Session::route_solo_changed (void* src, shared_ptr<Route> route)
        }
        
        bool is_track;
-       
-       is_track = (dynamic_cast<AudioTrack*>(route.get()) != 0);
+       boost::shared_ptr<Route> route = wpr.lock ();
+
+       if (!route) {
+               /* should not happen */
+               error << string_compose (_("programming error: %1"), X_("invalid route weak ptr passed to route_solo_changed")) << endmsg;
+               return;
+       }
+
+       is_track = (boost::dynamic_pointer_cast<AudioTrack>(route) != 0);
        
        shared_ptr<RouteList> r = routes.reader ();