ApplicationCommandManager::removeAllCommandsForTarget()

Hi,

I have just added the below function to my ApplicationCommandManager subclass and thought it might be a worthy addition to JUCE proper. I use it in destructors to clean up commands when components go away.

[code]void ApplicationCommandManager::removeAllCommandsForTarget(ApplicationCommandTarget* target)
{
if (target) {
Array commandIDs;
target->getAllCommands(commandIDs);

    for (int i = 0; i < commandIDs.size(); i++)
        removeCommand(commandIDs[i]);
}

}
[/code]

Hmm… It’d be easy to mess things up with that. If you had multiple components that all responded to the same command ID, then by removing one of them, you’d stop the remaining ones responding to that command…

Ok, I can see that. Not in my case but still. Never mind then. :wink: