1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

iOS: Allow multiple instances of ScopedJuceInitialiser_GUI

Previously, the UnitTestRunner example in the DemoRunner would fail on
any tests that included ScopedJuceInitialiser_GUI, as DeletedAtShutdown
objects would be destroyed too early.
This commit is contained in:
reuk 2024-02-27 16:08:46 +00:00
parent 238a99caf8
commit f024e7ab09
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -53,6 +53,7 @@ namespace juce
#endif
{
UIBackgroundTaskIdentifier appSuspendTask;
std::optional<ScopedJuceInitialiser_GUI> initialiser;
}
@property (strong, nonatomic) UIWindow *window;
@ -137,7 +138,7 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE
- (void) applicationDidFinishLaunching: (UIApplication*) application
{
ignoreUnused (application);
initialiseJuce_GUI();
initialiser.emplace();
if (auto* app = JUCEApplicationBase::createInstance())
{