From 86a5a0fcfdc9115f0f504723d428bebf77fcb030 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Sun, 23 Oct 2022 10:01:43 -0700 Subject: [PATCH] timeline: commit imported footage before connecting Fixes #2065 --- app/widget/timelinewidget/timelinewidget.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/widget/timelinewidget/timelinewidget.cpp b/app/widget/timelinewidget/timelinewidget.cpp index 82c22b2a8..943242ee8 100644 --- a/app/widget/timelinewidget/timelinewidget.cpp +++ b/app/widget/timelinewidget/timelinewidget.cpp @@ -795,15 +795,20 @@ void TimelineWidget::RecordingCallback(const QString &filename, const TimeRange ProjectImportTask task(GetConnectedNode()->project()->root(), {filename}); task.Start(); - MultiUndoCommand *import_command = task.GetCommand(); + auto subimport_command = task.GetCommand(); if (task.GetImportedFootage().empty()) { qCritical() << "Failed to import recorded audio file" << filename; + delete subimport_command; } else { - import_tool_->PlaceAt({task.GetImportedFootage().front()}, time.in(), false, import_command, track.index()); - } + subimport_command->redo_now(); - Core::instance()->undo_stack()->pushIfHasChildren(import_command); + auto import_command = new MultiUndoCommand(); + import_command->add_child(subimport_command); + + import_tool_->PlaceAt({task.GetImportedFootage().front()}, time.in(), false, import_command, track.index()); + Core::instance()->undo_stack()->pushIfHasChildren(import_command); + } } void TimelineWidget::EnableRecordingOverlay(const TimelineCoordinate &coord)