1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 07:39:42 +02:00

Fix crash in script pipe caused by commit 9eb9104

This commit is contained in:
Paul Licameli 2019-05-20 19:45:30 -04:00
parent 4c3729040f
commit 02d5e6c597

View File

@ -27,9 +27,8 @@
#include "../commands/Command.h"
CommandHandler::CommandHandler()
: mCurrentContext(std::make_unique<CommandContext>
(*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<bool>( [&] {
return cmd->Apply(*mCurrentContext);
return cmd->Apply( context );
});
wxUnusedVar(result);
// Redraw the project
mCurrentContext->project.RedrawProject();
context.project.RedrawProject();
}