diff --git a/gtk2_ardour/hit.cc b/gtk2_ardour/hit.cc index 7f2a32af5e..da6fcece21 100644 --- a/gtk2_ardour/hit.cc +++ b/gtk2_ardour/hit.cc @@ -40,9 +40,7 @@ Hit::Hit (MidiView& region, Item* parent, double size, const std::shared_ptrclear (true); - /* The above did not actually delete the the NoteBase* elements, so do that now */ for (auto & [model_note,gui_note] : _events) { delete gui_note; } + /* This will delete any danging canvas items that were not owned by the + * NoteBase objects we just deleted. + */ + _note_group->clear (true); _events.clear(); _patch_changes.clear(); _sys_exes.clear(); diff --git a/gtk2_ardour/note.cc b/gtk2_ardour/note.cc index 2fcf37f763..7ccba8b808 100644 --- a/gtk2_ardour/note.cc +++ b/gtk2_ardour/note.cc @@ -39,9 +39,7 @@ Note::Note (MidiView& region, ArdourCanvas::Item* parent, const std::shared_ptr< Note::~Note () { - /* do not delete the canvas item here, because that will be handled by - * the parent - */ + delete _visual_note; } void diff --git a/gtk2_ardour/note_base.cc b/gtk2_ardour/note_base.cc index deb9c2527e..4a5d7e6f04 100644 --- a/gtk2_ardour/note_base.cc +++ b/gtk2_ardour/note_base.cc @@ -88,7 +88,7 @@ NoteBase::NoteBase(MidiView& v, bool with_events, const std::shared_ptr