timeline: refactored "replace with gap" command fixed bug

Fixes an unfortunate bug that restored blocks in the wrong order and leads
to a segfault if you continue undoing beyond that point.
This commit is contained in:
itsmattkc
2020-08-20 13:40:58 +10:00
parent 75c3a37c17
commit d99a8e9005
3 changed files with 88 additions and 76 deletions
@@ -483,6 +483,12 @@ void TimelineWidget::ReplaceBlocksWithGaps(const QList<Block *> &blocks,
QUndoCommand *command)
{
foreach (Block* b, blocks) {
if (b->type() == Block::kGap) {
// No point in replacing a gap with a gap, and TrackReplaceBlockWithGapCommand will clear
// up any extraneous gaps
continue;
}
TrackOutput* original_track = TrackOutput::TrackFromBlock(b);
new TrackReplaceBlockWithGapCommand(original_track, b, command);