In order so that i don’t have to have a copy of the code from JUCEApplication::initialiseApp() (specifically, the part that does appLock = new InterProcessLock (“juceAppLock_” + getApplicationName())), I would like to have a little access to the ScopedPointer appLock.
Specifically, when I get an exception and force my app to terminate after launching a second instance with a command line instructing it to show an alert, I would like to release the InterProcessLock by doing
Okay, well how about moving this bit into a protected member of JUCEApplication that I can call from my initialise, so that I don’t have to make a copy of it:
#if ! JUCE_IOS
jassert (appLock == 0); // initialiseApp must only be called once!
if (! moreThanOneInstanceAllowed())
{
appLock = new InterProcessLock ("juceAppLock_" + getApplicationName());
if (! appLock->enter(0))
{
appLock = 0;
MessageManager::broadcastMessage (getApplicationName() + "/" + commandLineParameters);
DBG ("Another instance is running - quitting...");
return false;
}
}
#endif
Yes. And on iOS the startup is handled in a completely different way altogether. Best to just stick to the public interfaces and don’t go poking around in the implementation.