Fix somewhat unlikely crash on doing add note; start drag to resize note; undo; finish drag to resize note.

git-svn-id: svn://localhost/ardour2/branches/3.0@10880 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-12-03 03:05:59 +00:00
parent 5931ff08ed
commit f817155f20
4 changed files with 24 additions and 1 deletions

View File

@ -1529,7 +1529,10 @@ NoteResizeDrag::finished (GdkEvent*, bool /*movement_occurred*/)
void
NoteResizeDrag::aborted (bool)
{
/* XXX: TODO */
MidiRegionSelection& ms (_editor->get_selection().midi_regions);
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
(*r)->abort_resizing ();
}
}
RegionGainDrag::RegionGainDrag (Editor* e, ArdourCanvas::Item* i)

View File

@ -104,6 +104,10 @@ using Gtkmm2ext::Keyboard;
void
Editor::undo (uint32_t n)
{
if (_drags->active ()) {
_drags->abort ();
}
if (_session) {
_session->undo (n);
}
@ -112,6 +116,10 @@ Editor::undo (uint32_t n)
void
Editor::redo (uint32_t n)
{
if (_drags->active ()) {
_drags->abort ();
}
if (_session) {
_session->redo (n);
}

View File

@ -2677,6 +2677,17 @@ MidiRegionView::commit_resizing (ArdourCanvas::CanvasNoteEvent* primary, bool at
apply_diff();
}
void
MidiRegionView::abort_resizing ()
{
for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
delete (*i)->resize_rect;
delete *i;
}
_resize_data.clear ();
}
void
MidiRegionView::change_note_velocity(CanvasNoteEvent* event, int8_t velocity, bool relative)
{

View File

@ -218,6 +218,7 @@ public:
void update_resizing (ArdourCanvas::CanvasNoteEvent*, bool, double, bool);
void commit_resizing (ArdourCanvas::CanvasNoteEvent*, bool, double, bool);
void abort_resizing ();
/** Change the channel of the selection.
* @param channel - the channel number of the new channel, zero-based