runModalLoop & mouse

I wrote a kind of Splashscreen with ProgressBar class that runs before the app starts, which works, but at the end it will only exit its runModalLoop() if I move the mouse. This is still JUCE 146, I read in the forum that there were some problems with runModalLoop() and that it could hang until mouse movement occured, but I didn’t find any specifics, … Is there a quick fix for this and what’s the reason for the problem?

Long since fixed… can’t even remember the details, it was something to do with the event loop waiting for a mouse event before checking the quit flag.

Do you maybe know in which file the bug was, so I could check the SVN for changes? I really can’t find the bug on my own… BTW pressing any key does also make exitModalState() exit for good, not only moving the mouse or pressing the mouse button again.

Sorry, it’s lost in the mists of time… Probably messagemanager or the platform-specific messaging code.

It does not happen on Windows, only on OS X so far, if that’s a clue. I’m gonna try to find it but I know already that this is gonna cost me a day…

ok, i fixed it this way:

while (flags.currentlyModalFlag && flags.visibleFlag)
// if (! MessageManager::getInstance()->dispatchNextMessage()) // old!
// break;
MessageManager::getInstance()->dispatchNextMessage(true,0); // new!

        // check whether this component was deleted during the last message
        if (! isValidMessageListener())

I just wanted to ask you if this couldn’t do any negative side effects (crashes?). Basically dispatchNextMessage() now returns immediately instead of sitting there and waiting.

I think it came down to the fact that the message loop was sitting there waiting for an event, and only when one arrived did it get chance to check whether the quit signal had been sent and exit the loop. The fix would have been to send a dummy event when you call quit. It’s probably described here in the forum somewhere if you search.

Exactly, your solution is even better. So what I did now is to add the postMessage() line in Component::exitModalState()

flags.currentlyModalFlag = false; postMessage (new Message (bogusMessage, 0, 0, 0)); // <--- otherwise it hangs on OS X
Seems to do the job… So I can release my stuff now, thanks.