From a19e79f4f07a65b6fe6b5069ab4a88d14e29e21e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 14 Nov 2010 23:47:09 +0000 Subject: Fix crashes after removing markers. git-svn-id: svn://localhost/ardour2/branches/3.0@8039 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor.h | 1 + gtk2_ardour/editor_markers.cc | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index a8c5fa3db5..2b08569220 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -637,6 +637,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD * for all markers or for just a few. */ std::map > _sorted_marker_lists; + void remove_sorted_marker (Marker *); void hide_marker (ArdourCanvas::Item*, GdkEvent*); void clear_marker_display (); diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 3f9c65a4c2..78c1edb8b0 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -55,6 +55,7 @@ Editor::clear_marker_display () } location_markers.clear (); + _sorted_marker_lists.clear (); } void @@ -495,6 +496,12 @@ Editor::refresh_location_display_internal (Locations::LocationList& locations) ++tmp; if (!i->second->valid) { + + remove_sorted_marker (i->second->start); + if (i->second->end) { + remove_sorted_marker (i->second->end); + } + delete i->second; location_markers.erase (i); } @@ -699,8 +706,15 @@ Editor::location_gone (Location *location) } for (i = location_markers.begin(); i != location_markers.end(); ++i) { - if ((*i).first == location) { - delete (*i).second; + if (i->first == location) { + + remove_sorted_marker (i->second->start); + if (i->second->end) { + remove_sorted_marker (i->second->end); + } + + + delete i->second; location_markers.erase (i); break; } @@ -1496,3 +1510,11 @@ Editor::toggle_marker_lines () i->second->set_show_lines (_show_marker_lines); } } + +void +Editor::remove_sorted_marker (Marker* m) +{ + for (std::map >::iterator i = _sorted_marker_lists.begin(); i != _sorted_marker_lists.end(); ++i) { + i->second.remove (m); + } +} -- cgit v1.2.3