Assertion with new singleton changes


#1

Seems someone moved a hint too quickly: OnScreenKeyboard asserts on app shutdown. It’s a class on the Windows side of things.


#2

Thanks! I’ll sort that out.

Yep, adding that new assertion is catching a few places where people have forgotten to add their clearSingletonInstance() calls in the destructors…


#3

It’s quite possible/likely that I’m doing something daft, but this is tripping me up due to the doNotRecreateAfterDeletion flag being set to true for OnScreenKeyboard.

I’m loading Juce inside a DLL hosted in another app (not a standard plugin host) and when I unload and then reload my DLL (which effectively shuts Juce down and then starts it again) I hit a jassert complaining that the OnScreenKeyboard can’t be recreated. When I change the Juce code to use false for the doNotRecreateAfterDeletion flag all is well, but I don’t have a tablet to test with and I worry that this could cause issues.


#4
@ -802,7 +802,7 @@ struct OnScreenKeyboard   : public DeletedAtShutdown,
        startTimer (10);
    }

- JUCE_DECLARE_SINGLETON_SINGLETHREADED (OnScreenKeyboard, true)
+ JUCE_DECLARE_SINGLETON_SINGLETHREADED (OnScreenKeyboard, false)

private:
    OnScreenKeyboard()

That’s the change I have to make in modules\juce_gui_basics\native\juce_win32_Windowing.cpp

Any risk in me doing that? It would be great if I didn’t have to patch when grabbing a Juce update though…


#5

Yeah, that just looks like an oversight to me, there’s no reason it couldn’t be re-created after deletion. Thanks, I’ll push that change!


#6

Awesome, thanks @jules