1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-20 14:20:06 +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" #include "../commands/Command.h"
CommandHandler::CommandHandler() CommandHandler::CommandHandler()
: mCurrentContext(std::make_unique<CommandContext> {
(*GetActiveProject())) }
{ }
CommandHandler::~CommandHandler() CommandHandler::~CommandHandler()
{ {
@ -38,7 +37,6 @@ CommandHandler::~CommandHandler()
void CommandHandler::SetProject(AudacityProject *) void CommandHandler::SetProject(AudacityProject *)
{ {
// TODO: Review if the extend command handling is ever utilized // TODO: Review if the extend command handling is ever utilized
// mCurrentContext->proj = proj;
} }
void CommandHandler::OnReceiveCommand(AppCommandEvent &event) void CommandHandler::OnReceiveCommand(AppCommandEvent &event)
@ -54,11 +52,12 @@ void CommandHandler::OnReceiveCommand(AppCommandEvent &event)
// Then apply it to current application & project. Note that the // Then apply it to current application & project. Note that the
// command may change the context - for example, switching to a // command may change the context - for example, switching to a
// different project. // different project.
CommandContext context{ *GetActiveProject() };
auto result = GuardedCall<bool>( [&] { auto result = GuardedCall<bool>( [&] {
return cmd->Apply(*mCurrentContext); return cmd->Apply( context );
}); });
wxUnusedVar(result); wxUnusedVar(result);
// Redraw the project // Redraw the project
mCurrentContext->project.RedrawProject(); context.project.RedrawProject();
} }