From 3fdfa8fdc7d9e9fb20e68bc7ca1736f4ca95e334 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 25 Apr 2024 09:49:55 -0400 Subject: [PATCH] Issue 6340: wrong vertical scroll recording to new track... ... Solution is to delay the scrolling until after TrackListEvent subscriptions fire and update the cumulative ChannelView heights. --- src/ProjectAudioManager.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ProjectAudioManager.cpp b/src/ProjectAudioManager.cpp index fcdcdb3331c8..3d49c61f074c 100644 --- a/src/ProjectAudioManager.cpp +++ b/src/ProjectAudioManager.cpp @@ -967,8 +967,15 @@ bool ProjectAudioManager::DoRecord(AudacityProject &project, pendingTracks.RegisterPendingNewTracks(std::move(*newTracks)); // Bug 1548. First of new tracks needs the focus. TrackFocus::Get(project).Set(first); - if (!trackList.empty()) - Viewport::Get(project).ShowTrack(**trackList.rbegin()); + if (!trackList.empty()) { + BasicUI::CallAfter([pProject = project.weak_from_this()]{ + if (!pProject.expired()) { + auto &project = *pProject.lock(); + auto &trackList = TrackList::Get(project); + Viewport::Get(project).ShowTrack(**trackList.rbegin()); + } + }); + } } //Automated Input Level Adjustment Initialization