From 178ac74596e54a24046c08fcfeb1d65fa8060957 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 10 Sep 2021 19:11:42 +0200 Subject: [PATCH] Fix crash due to missing retain in wxUILocale wxMac code We need to retain [NSLocale availableLocaleIdentifiers] result too, as it doesn't copy the returned object. --- src/osx/core/uilocale.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osx/core/uilocale.mm b/src/osx/core/uilocale.mm index 3b76e7a069..307ac5ca38 100644 --- a/src/osx/core/uilocale.mm +++ b/src/osx/core/uilocale.mm @@ -86,7 +86,7 @@ public: // completely invalid strings, so we need to check if the name is // actually in the list of the supported locales ourselves. static wxCFRef - all((CFArrayRef)[NSLocale availableLocaleIdentifiers]); + all((CFArrayRef)[[NSLocale availableLocaleIdentifiers] retain]); wxCFStringRef cfName(locId.GetName()); if ( ![(NSArray*)all.get() containsObject: cfName.AsNSString()] )