Fix crashes after removing markers.

git-svn-id: svn://localhost/ardour2/branches/3.0@8039 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-11-14 23:47:09 +00:00
parent b55ef985f5
commit a19e79f4f0
2 changed files with 25 additions and 2 deletions

View File

@ -637,6 +637,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
* for all markers or for just a few.
*/
std::map<ArdourCanvas::Group *, std::list<Marker *> > _sorted_marker_lists;
void remove_sorted_marker (Marker *);
void hide_marker (ArdourCanvas::Item*, GdkEvent*);
void clear_marker_display ();

View File

@ -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<ArdourCanvas::Group *, std::list<Marker *> >::iterator i = _sorted_marker_lists.begin(); i != _sorted_marker_lists.end(); ++i) {
i->second.remove (m);
}
}