13
0

Fix use-after-free when undoing marker creation

Create a marker by ctrl-click, hover over it and then ctrl+z
undo. This used to crash in Editor::get_preferred_edit_position()
gtk2_ardour/editor.cc:5179, checking for entered_marker->position()
This commit is contained in:
Robin Gareus 2023-09-06 17:37:11 +02:00
parent c2ce0bcb4a
commit 80a813ff1c
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -69,6 +69,8 @@ Editor::clear_marker_display ()
delete i->second;
}
entered_marker = 0;
location_markers.clear ();
_sorted_marker_lists.clear ();
}
@ -619,6 +621,11 @@ Editor::refresh_location_display_internal (const Locations::LocationList& locati
LocationMarkers* m = i->second;
location_markers.erase (i);
if (m && (entered_marker == m->start || entered_marker == m->end)) {
entered_marker = 0;
}
delete m;
}
@ -896,6 +903,10 @@ Editor::remove_marker (ArdourMarker* marker)
return;
}
if (entered_marker == marker) {
entered_marker = 0;
}
if (marker->type() == ArdourMarker::RegionCue) {
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::really_remove_region_marker), marker));
} else {
@ -970,6 +981,11 @@ Editor::location_gone (Location *location)
LocationMarkers* m = i->second;
location_markers.erase (i);
if (m && (entered_marker == m->start || entered_marker == m->end)) {
entered_marker = 0;
}
delete m;
/* Markers that visually overlap with this (removed) marker