jassert ApplicationCommandTarget::tryToInvoke()


#1

I can’t seem to shake off this jassert, every time I invoke a menu command my debugger takes me here:

      jassert (success);  // hmm - your target should have been able to perform this command. If it can't
                            // do it at the moment for some reason, it should clear the 'isActive' flag when it
                            // returns the command's info.

I’m not sure how I clear the ‘isActive’ flag. I’m guessing it should be done in my getCommandInfo() method, if so how do I clear that flag? I’ve gone over the documentation for ApplicationCommandInfo::CommandFlags but I don’t see any isActive flag? I’m determined to not have a single jassert in my latest project!


#2

Please go through this http://www.rawmaterialsoftware.com/api/structApplicationCommandInfo.html#3cedc332d71fcc140aa7891887af0ee3


#3

Tanks I did go through that but I guess got a little confused as the jassert says to clear the isActive bit whereas the docs explain how to clear the isDisabled bit, I guess the isActive and isDisabled bit are the same? Anyhow, this still didn’t get rid of my jassert, I call setActive(true); in my getCommandInfo method but I keep getting that jassert. Am I clearing the isActive bit in the right place?


#4

I am not very sure about this. I never had to face this issue, but ideally you should be setting the flag in this method “bool perform (const InvocationInfo &info)”. If you don’t handle a action just mark it to be inactive.


#5

Thanks, I have it running now without any asserts.


#6

I’ve bumped into a few spurious cases of that assertion myself, but haven’t dug into it deeply yet…