ApplicationCommandTarget again


#1

i have a question: inside perform is good if a command invokeDirectly another command in the same perform ? or is better to call invoke from the command manager ?

while debugging i found this:

[code]bool ApplicationCommandTarget::invoke (const InvocationInfo& info, const bool async)
{
ApplicationCommandTarget* target = this;
int depth = 0;

while (target != 0)
{
    if (target->tryToInvoke (info, async))
        return true;

    target = target->getNextCommandTarget();

    jassert (depth < 100); // could be a recursive command chain??
    jassert (target != this); // definitely a recursive command chain!

    if (depth > 100 || target == this)
        break;
}

if (target == 0)
{
    target = JUCEApplication::getInstance();

    if (target != 0)
        return target->tryToInvoke (info, async);
}

return false;

}[/code]

shouldn’t depth be incremented before asserting ?


#2

Can’t think of any reason not to call invokeDirectly inside another call…

(And ahem… yes, thankyou for noticing that bugette!)


#3

the depth stuff is also in the function before that, i don’t think it will be reached most of the running time but just to notice


#4