update CycleTimer to utilize NDEBUG and PBD::DEBUG so that we can leave them in place...
[ardour.git] / gtk2_ardour / global_port_matrix.cc
index df224245201c8140b3f5b2d464db7a55b15b1348..f4803f156ba201fe6f9c8c19f57de8dbb2158ed9 100644 (file)
@@ -56,8 +56,8 @@ GlobalPortMatrix::set_state (BundleChannel c[2], bool s)
        for (Bundle::PortList::const_iterator i = in_ports.begin(); i != in_ports.end(); ++i) {
                for (Bundle::PortList::const_iterator j = out_ports.begin(); j != out_ports.end(); ++j) {
 
-                       Port* p = _session->engine().get_port_by_name (*i);
-                       Port* q = _session->engine().get_port_by_name (*j);
+                       boost::shared_ptr<Port> p = _session->engine().get_port_by_name (*i);
+                       boost::shared_ptr<Port> q = _session->engine().get_port_by_name (*j);
 
                        if (p) {
                                if (s) {
@@ -90,6 +90,10 @@ GlobalPortMatrix::get_state (BundleChannel c[2]) const
                return PortMatrixNode::NOT_ASSOCIATED;
        }
 
+       if (c[0].bundle->nchannels() == ChanCount::ZERO || c[1].bundle->nchannels() == ChanCount::ZERO) {
+               return PortMatrixNode::NOT_ASSOCIATED;
+       }
+
        Bundle::PortList const & in_ports = c[IN].bundle->channel_ports (c[IN].channel);
        Bundle::PortList const & out_ports = c[OUT].bundle->channel_ports (c[OUT].channel);
        if (in_ports.empty() || out_ports.empty()) {
@@ -101,8 +105,8 @@ GlobalPortMatrix::get_state (BundleChannel c[2]) const
        for (Bundle::PortList::const_iterator i = in_ports.begin(); i != in_ports.end(); ++i) {
                for (Bundle::PortList::const_iterator j = out_ports.begin(); j != out_ports.end(); ++j) {
 
-                       Port* p = _session->engine().get_port_by_name (*i);
-                       Port* q = _session->engine().get_port_by_name (*j);
+                       boost::shared_ptr<Port> p = _session->engine().get_port_by_name (*i);
+                       boost::shared_ptr<Port> q = _session->engine().get_port_by_name (*j);
 
                        if (!p && !q) {
                                /* two non-Ardour ports; things are slightly more involved */
@@ -144,8 +148,8 @@ GlobalPortMatrix::get_state (BundleChannel c[2]) const
 }
 
 GlobalPortMatrixWindow::GlobalPortMatrixWindow (Session* s, DataType t)
-       : ArdourDialog (X_("reset me soon"))
-        , _port_matrix (this, s, t)
+       : ArdourWindow (X_("reset me soon"))
+       , _port_matrix (this, s, t)
 {
        switch (t) {
        case DataType::AUDIO:
@@ -156,7 +160,7 @@ GlobalPortMatrixWindow::GlobalPortMatrixWindow (Session* s, DataType t)
                break;
        }
 
-       get_vbox()->pack_start (_port_matrix, true, true);
+       add (_port_matrix);
        _port_matrix.show ();
 }