1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Some inversion of control flow when popping Undo state

This commit is contained in:
Paul Licameli
2018-02-16 14:49:26 -05:00
parent 2741d58880
commit 4f7d308ca3
4 changed files with 19 additions and 25 deletions

View File

@@ -4673,6 +4673,8 @@ void AudacityProject::ModifyState(bool bWantsAutoSave)
// Need to keep it and its tracks "t" available for Undo/Redo/SetStateTo.
void AudacityProject::PopState(const UndoState &state)
{
mViewInfo.selectedRegion = state.selectedRegion;
// Restore tags
mTags = state.tags;
@@ -4725,9 +4727,8 @@ void AudacityProject::PopState(const UndoState &state)
void AudacityProject::SetStateTo(unsigned int n)
{
const UndoState &state =
GetUndoManager()->SetStateTo(n, &mViewInfo.selectedRegion);
PopState(state);
GetUndoManager()->SetStateTo(n,
[this]( const UndoState &state ){ PopState(state); } );
HandleResize();
mTrackPanel->SetFocusedTrack(NULL);