fix crash when loading a saved visual state

This commit is contained in:
Robin Gareus 2016-07-05 23:49:50 +02:00
parent 412fcafda0
commit 2f71967be2
2 changed files with 5 additions and 2 deletions

View file

@ -4383,7 +4383,7 @@ Editor::current_visual_state (bool with_tracks)
vs->zoom_focus = zoom_focus; vs->zoom_focus = zoom_focus;
if (with_tracks) { if (with_tracks) {
*vs->gui_state = *ARDOUR_UI::instance()->gui_object_state; vs->gui_state->set_state (ARDOUR_UI::instance()->gui_object_state->get_state());
} }
return vs; return vs;
@ -4448,7 +4448,7 @@ Editor::use_visual_state (VisualState& vs)
reposition_and_zoom (vs.leftmost_frame, vs.samples_per_pixel); reposition_and_zoom (vs.leftmost_frame, vs.samples_per_pixel);
if (vs.gui_state) { if (vs.gui_state) {
*ARDOUR_UI::instance()->gui_object_state = *vs.gui_state; ARDOUR_UI::instance()->gui_object_state->set_state (vs.gui_state->get_state());
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->clear_property_cache(); (*i)->clear_property_cache();

View file

@ -66,6 +66,9 @@ public:
static XMLNode* get_or_add_node (XMLNode *, const std::string &); static XMLNode* get_or_add_node (XMLNode *, const std::string &);
private: private:
// no copy construction. object_map saves pointers to _state XMLNodes
// use set_state(get_state())
GUIObjectState (const GUIObjectState& other);
XMLNode _state; XMLNode _state;
// ideally we'd use a O(1) hash table here, // ideally we'd use a O(1) hash table here,