fix redrawing of canvas with an optimized build
[ardour.git] / gtk2_ardour / rc_option_editor.cc
index da6d2344c28c745be693b0ef8b23cc7e03cbab8a..3a5cab0289646c1d68ca55ac256ab8b4abcb2cf0 100644 (file)
@@ -648,6 +648,7 @@ class ControlSurfacesOptions : public OptionEditorBox
 public:
        ControlSurfacesOptions (Gtk::Window& parent)
                : _parent (parent)
+               , _ignore_view_change (0)
        {
                _store = ListStore::create (_model);
                _view.set_model (_store);
@@ -700,9 +701,14 @@ private:
         void protocol_status_changed (ControlProtocolInfo* cpi) {
                /* find the row */
                TreeModel::Children rows = _store->children();
+               
                for (TreeModel::Children::iterator x = rows.begin(); x != rows.end(); ++x) {
+                       string n = ((*x)[_model.name]);
+
                        if ((*x)[_model.protocol_info] == cpi) {
+                               _ignore_view_change++;
                                (*x)[_model.enabled] = (cpi->protocol || cpi->requested);
+                               _ignore_view_change--;
                                break;
                        }
                }
@@ -712,6 +718,10 @@ private:
        {
                TreeModel::Row r = *i;
 
+               if (_ignore_view_change) {
+                       return;
+               }
+
                ControlProtocolInfo* cpi = r[_model.protocol_info];
                if (!cpi) {
                        return;
@@ -720,22 +730,23 @@ private:
                bool const was_enabled = (cpi->protocol != 0);
                bool const is_enabled = r[_model.enabled];
 
+
                if (was_enabled != is_enabled) {
+
                        if (!was_enabled) {
-                               ControlProtocolManager::instance().instantiate (*cpi);
+                               ControlProtocolManager::instance().activate (*cpi);
                        } else {
                                Gtk::Window* win = r[_model.editor];
                                if (win) {
                                        win->hide ();
                                }
 
-                               ControlProtocolManager::instance().teardown (*cpi);
+                               ControlProtocolManager::instance().deactivate (*cpi);
                                        
                                if (win) {
                                        delete win;
+                                       r[_model.editor] = 0;
                                }
-                               r[_model.editor] = 0;
-                               cpi->requested = false;
                        }
                }
 
@@ -805,6 +816,7 @@ private:
        TreeView _view;
         Gtk::Window& _parent;
         PBD::ScopedConnection protocol_status_connection;
+        uint32_t _ignore_view_change;
 };
 
 class VideoTimelineOptions : public OptionEditorBox