I have a ChangeBroadcaster that is posting a message to the system queue. In so doing, I see that the reference count of the MessageManager::MessageBase* object is explicitly incremented
(@see juce_wine32_Messaging.cpp: bool MessageManager::postMessageToSystemQueue).
I also see that once the message is dispatched, the reference count is explicitly decremented.
(@see juce_wine32_Messaging.cpp: void WindowsMessageHelpers::dispatchMessageFromLParam).
I’ve run into a problem whereby my application shutdown logic posts a couple of messages to the system queue (via the ChangeBroadcaster), but the messages are not dispatched (and hence the reference counts are not decremented) before application shutdown. This leads to a tiny memory leak on shutdown. I’ve currently worked around the issue by explicitly preventing specific change broadcast messages from being sent from my application shutdown logic, but this feels hacky.
How can I delay Juce shutdown until all messages from the system queue have been dispatched !? We are currently making use of ScopedJuceInitialiser_GUI to Init and Shutdown Juce from main, or is there another approach I should be using?!
Thank you !!