Fix crash if new tempo is set to start at bar #0 / Follow-up for non movable meters
[ardour.git] / gtk2_ardour / axis_view.cc
index 43763abcc37166e33f10d2c0520d4f6fc4429dca..5e36fc43c1e5a7bc04a4dcdeb38b0cf899c04eb1 100644 (file)
@@ -32,9 +32,6 @@
 #include <gtkmm2ext/selector.h>
 #include <gtkmm2ext/gtk_ui.h>
 
-#include "ardour/session.h"
-#include "ardour/utils.h"
-
 #include "public_editor.h"
 #include "ardour_ui.h"
 #include "gui_object.h"
@@ -46,6 +43,7 @@ using namespace std;
 using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
 
 list<Gdk::Color> AxisView::used_colors;
 
@@ -68,7 +66,14 @@ AxisView::unique_random_color()
 string
 AxisView::gui_property (const string& property_name) const
 {
-       return gui_object_state().get_string (state_id(), property_name);
+       if (property_hashtable.count(property_name)) {
+               return property_hashtable[property_name];
+       } else {
+         string rv = gui_object_state().get_string (state_id(), property_name);
+               property_hashtable.erase(property_name);
+               property_hashtable.emplace(property_name, rv);
+               return rv;
+       }
 }
 
 bool
@@ -86,7 +91,6 @@ AxisView::set_marked_for_display (bool yn)
                set_gui_property ("visible", yn);
                return true; // things changed
        }
-
        return false;
 }