send control now has working metering, and switches back and forth between busses...
[ardour.git] / gtk2_ardour / panner_ui.cc
index 4777c82479f77a6ef5bbdb7ffa5126866eec1fa0..3ffec0ab05bfbebcef55bc8e5d138e03f48517a4 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "i18n.h"
 
+using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 using namespace Gtkmm2ext;
@@ -132,7 +133,7 @@ PannerUI::PannerUI (Session& s)
 void
 PannerUI::set_io (boost::shared_ptr<IO> io)
 {
-       if (!io->panner()) {
+       if (io && !io->panner()) {
                cerr << "PannerUI::set_io IO has no panners" << endl;
                return;
        }
@@ -147,15 +148,16 @@ PannerUI::set_io (boost::shared_ptr<IO> io)
                        
        _io = io;
  
-       connections.push_back (_io->panner()->Changed.connect (
-                       mem_fun(*this, &PannerUI::panner_changed)));
-       connections.push_back (_io->panner()->LinkStateChanged.connect (
-                       mem_fun(*this, &PannerUI::update_pan_linkage)));
-       connections.push_back (_io->panner()->StateChanged.connect (
-                       mem_fun(*this, &PannerUI::update_pan_state)));
        delete panner;
        panner = 0;
+
+       if (!_io) {
+               return;
+       }
+       connections.push_back (_io->panner()->Changed.connect (mem_fun(*this, &PannerUI::panner_changed)));
+       connections.push_back (_io->panner()->LinkStateChanged.connect (mem_fun(*this, &PannerUI::update_pan_linkage)));
+       connections.push_back (_io->panner()->StateChanged.connect (mem_fun(*this, &PannerUI::update_pan_state)));
  
        setup_pan ();
 
@@ -337,7 +339,7 @@ PannerUI::update_pan_state ()
 void
 PannerUI::setup_pan ()
 {
-       if (!_io->panner()) {
+       if (!_io || !_io->panner()) {
                return;
        }