1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 16:40:07 +02:00

Bug 2294 - Scripting: Crash on "Close" command

This commit is contained in:
James Crook 2020-03-22 11:33:50 +00:00
parent a072e21b77
commit ecba41ad2d
2 changed files with 10 additions and 0 deletions

View File

@ -364,6 +364,13 @@ MacroCommandsCatalog::MacroCommandsCatalog( const AudacityProject *project )
// prefers slightly different parenthesis characters
label.Join( XO("(%s)").Format( mNames[i].GET() ), wxT(" ") );
// Bug 2294. The Close command pulls the rug out from under
// batch processing, because it destroys the project.
// So it is UNSAFE for scripting, and therefore excluded from
// the catalog.
if (mNames[i] == "Close")
continue;
commands.push_back(
{
{

View File

@ -50,6 +50,9 @@ bool BatchEvalCommand::Apply(const CommandContext & context)
// Uh oh, I need to build a catalog, expensively
// Maybe it can be built in one long-lived place and shared among command
// objects instead?
// The catolog though may change during a session, as it includes the
// names of macro commands - so the long-lived copy will need to
// be refreshed after macros are added/deleted.
MacroCommandsCatalog catalog(&context.project);
wxString macroName = GetString(wxT("MacroName"));