midiview: correctly manage NoteBase lifetimes
MidiView::clear_events() deleted the canvas items corresponding to Notes/Hits, but did not delete the owner NoteBase objects.
This commit is contained in:
@@ -40,7 +40,9 @@ Hit::Hit (MidiView& region, Item* parent, double size, const std::shared_ptr<Not
|
||||
|
||||
Hit::~Hit ()
|
||||
{
|
||||
delete _polygon;
|
||||
/* do not delete the visual note here, because that will be handled by
|
||||
* the parent
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -873,8 +873,12 @@ MidiView::clear_events ()
|
||||
// clear selection without signaling or trying to change state of event objects
|
||||
_selection.clear ();
|
||||
clear_ghost_events ();
|
||||
/* This will delete all the NoteBase* in the _events map */
|
||||
/* This will delete all the _visual_note members of the NoteBase* elements in the _events map */
|
||||
_note_group->clear (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;
|
||||
}
|
||||
_events.clear();
|
||||
_patch_changes.clear();
|
||||
_sys_exes.clear();
|
||||
|
||||
@@ -39,7 +39,9 @@ Note::Note (MidiView& region, ArdourCanvas::Item* parent, const std::shared_ptr<
|
||||
|
||||
Note::~Note ()
|
||||
{
|
||||
delete _visual_note;
|
||||
/* do not delete the canvas item here, because that will be handled by
|
||||
* the parent
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -88,8 +88,7 @@ NoteBase::NoteBase(MidiView& v, bool with_events, const std::shared_ptr<NoteType
|
||||
NoteBase::~NoteBase()
|
||||
{
|
||||
_view.note_deleted (this);
|
||||
|
||||
delete _text;
|
||||
/* do not delete _text, parent will do so */
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user