MemoryLeak with Message


#1

Consider the following

bool ApplicationCommandTarget::tryToInvoke (const InvocationInfo& info, const bool async)
{

<snip>
messageInvoker->postMessage (new Message (0, 0, 0, new ApplicationCommandTarget::InvocationInfo (info)));

Who deletes the allocated InvocationInfo?

It goes to MessageManager::instance->postMessageToQueue which then goes to juce_postMessageToSystemQueue which then calls customEvent.

void MessageManager::deliverMessage (void* message) deletes the Message but not the pointer.

I might just be paranoid!


#2

Don’t worry - the CommandTargetMessageInvoker deletes it just after using it…


#3

Thanks! Just chasing down a MessageManager assertion on shutdown(object still pending) and that grabbed my attention. (jassert (numPendingMessages == 0):wink:


#4

Oh, disregard, I see you removed the assertion in the tip.