diff --git a/src/commands/CommandHandler.cpp b/src/commands/CommandHandler.cpp index 70cff9317..bd7336e39 100644 --- a/src/commands/CommandHandler.cpp +++ b/src/commands/CommandHandler.cpp @@ -27,9 +27,8 @@ #include "../commands/Command.h" CommandHandler::CommandHandler() - : mCurrentContext(std::make_unique - (*GetActiveProject())) -{ } +{ +} CommandHandler::~CommandHandler() { @@ -38,7 +37,6 @@ CommandHandler::~CommandHandler() void CommandHandler::SetProject(AudacityProject *) { // TODO: Review if the extend command handling is ever utilized - // mCurrentContext->proj = proj; } void CommandHandler::OnReceiveCommand(AppCommandEvent &event) @@ -54,11 +52,12 @@ void CommandHandler::OnReceiveCommand(AppCommandEvent &event) // Then apply it to current application & project. Note that the // command may change the context - for example, switching to a // different project. + CommandContext context{ *GetActiveProject() }; auto result = GuardedCall( [&] { - return cmd->Apply(*mCurrentContext); + return cmd->Apply( context ); }); wxUnusedVar(result); // Redraw the project - mCurrentContext->project.RedrawProject(); + context.project.RedrawProject(); }