# HG changeset patch # User Chris Cannam # Date 1409738219 -3600 # Node ID 2d5a8219b4b00322535207a28ce791ac100ab056 # Parent 6b5e1edd95fcda7388dd4c22f01f27ff75ab419f Backed out changeset 6b5e1edd95fc. I had misunderstood, the container is a vector, not a map, so the fix doesn't work and the original code (although definitely flawed) actually does diff -r 6b5e1edd95fc -r 2d5a8219b4b0 data/fileio/MIDIFileReader.cpp --- a/data/fileio/MIDIFileReader.cpp Wed Sep 03 10:49:38 2014 +0100 +++ b/data/fileio/MIDIFileReader.cpp Wed Sep 03 10:56:59 2014 +0100 @@ -661,10 +661,7 @@ bool noteOffFound; for (MIDITrack::iterator i = m_midiComposition[track].begin(); - i != m_midiComposition[track].end(); ) { - - MIDITrack::iterator nexti = i; - ++nexti; + i != m_midiComposition[track].end(); i++) { if ((*i)->getMessageType() == MIDI_NOTE_ON && (*i)->getVelocity() > 0) { @@ -682,13 +679,6 @@ (*i)->setDuration((*j)->getTime() - (*i)->getTime()); - if (nexti == j) { - // we're about to erase j, invalidating nexti - // as well (but as this is a map, that is the - // only iterator to be invalidated) - ++nexti; - } - delete *j; m_midiComposition[track].erase(j); @@ -706,8 +696,6 @@ (*i)->setDuration((*j)->getTime() - (*i)->getTime()); } } - - i = nexti; } return notesOnTrack;