1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-22 15:20:15 +02:00

Fix memleak. Not observed, just saw it when browsing the code.

This commit is contained in:
lllucius 2014-06-10 06:03:51 +00:00
parent 6605ac07e2
commit a12818a912

View File

@ -1084,22 +1084,25 @@ bool CommandManager::HandleTextualCommand(wxString & Str, wxUint32 flags, wxUint
// Not one of the singleton commands. // Not one of the singleton commands.
// We could/should try all the list-style commands. // We could/should try all the list-style commands.
// instead we only try the effects. // instead we only try the effects.
EffectArray *effects; AudacityProject * proj = GetActiveProject();
AudacityProject * proj;
proj = GetActiveProject();
if( !proj ) if( !proj )
return false; return false;
bool result = false;
int effectFlags = ALL_EFFECTS | CONFIGURED_EFFECT; int effectFlags = ALL_EFFECTS | CONFIGURED_EFFECT;
effects = EffectManager::Get().GetEffects(effectFlags); EffectArray *effects = EffectManager::Get().GetEffects(effectFlags);
for(i=0; i<effects->GetCount(); i++) { if (effects) {
wxString effectName = (*effects)[i]->GetEffectName(); for(i=0; i<effects->GetCount(); i++) {
if( Str.IsSameAs( effectName )) wxString effectName = (*effects)[i]->GetEffectName();
{ if( Str.IsSameAs( effectName ))
return proj->OnEffect( effectFlags, (*effects)[i] ); {
result = proj->OnEffect( effectFlags, (*effects)[i] );
break;
}
} }
delete effects;
} }
return false; return result;
} }
void CommandManager::GetCategories(wxArrayString &cats) void CommandManager::GetCategories(wxArrayString &cats)