diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 10d869945a..e76433bcae 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -1324,16 +1324,16 @@ MidiRegionView::add_ghost (TimeAxisView& tv) ghost = new MidiGhostRegion (tv, trackview, unit_position); } - ghost->set_height (); - ghost->set_duration (_region->length() / samples_per_unit); - ghosts.push_back (ghost); - for (Events::iterator i = _events.begin(); i != _events.end(); ++i) { if ((note = dynamic_cast(*i)) != 0) { ghost->add_note(note); } } + ghost->set_height (); + ghost->set_duration (_region->length() / samples_per_unit); + ghosts.push_back (ghost); + GhostRegion::CatchDeletion.connect (*this, invalidator (*this), ui_bind (&RegionView::remove_ghost, this, _1), gui_context()); return ghost;