Another hacky fix for deadlocks when updating the port matrix.
authorCarl Hetherington <carl@carlh.net>
Mon, 6 Sep 2010 21:06:10 +0000 (21:06 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 6 Sep 2010 21:06:10 +0000 (21:06 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7747 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/port_matrix.cc
gtk2_ardour/port_matrix.h

index 1c89a36af7fc85653db47f5d8691e3450434e9bf..113a11c1163ef43f107a8b618f28a374f588af98 100644 (file)
@@ -154,7 +154,7 @@ PortMatrix::init ()
        _session->engine().PortRegisteredOrUnregistered.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports, this), gui_context());
 
        /* watch for route order keys changing, which changes the order of things in our global ports list(s) */
-       _session->RouteOrderKeyChanged.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports, this), gui_context());
+       _session->RouteOrderKeyChanged.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports_proxy, this), gui_context());
 
        /* Part 3: other stuff */
        
@@ -575,6 +575,16 @@ PortMatrix::setup_global_ports ()
        }
 }
 
+void
+PortMatrix::setup_global_ports_proxy ()
+{
+       /* Avoid a deadlock by calling this in an idle handler: see IOSelector::io_changed_proxy
+          for a discussion.
+       */
+
+       Glib::signal_idle().connect_once (sigc::mem_fun (*this, &PortMatrix::setup_global_ports));
+}
+
 void
 PortMatrix::setup_all_ports ()
 {
index a67292829be19e0852b498a1e33788fd10b15998..359b4540e31f0b4bf00ce46653b43ca5fea944ca 100644 (file)
@@ -180,6 +180,7 @@ private:
        void disassociate_all_on_channel (boost::weak_ptr<ARDOUR::Bundle>, uint32_t, int);
        void disassociate_all_on_bundle (boost::weak_ptr<ARDOUR::Bundle>, int);
        void setup_global_ports ();
+       void setup_global_ports_proxy ();
        void toggle_show_only_bundles ();
        bool on_scroll_event (GdkEventScroll *);
        boost::shared_ptr<ARDOUR::IO> io_from_bundle (boost::shared_ptr<ARDOUR::Bundle>) const;