mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-21 21:47:55 +08:00
Don't crash on start up if macOS system font encoding is unknown
If the encoding is not recognized (which is the case at least for the
encoding used for Persian/Farsi), wxLocale::GetSystemEncoding() returns
wxFONTENCODING_DEFAULT and wxFont::SetDefaultEncoding() must not be
called in this case, as it asserts and, due to a separate bug, crashes
as the GUI is not fully initialized yet when wxApp::Initialize() is
executing.
See #25561.
(cherry picked from commit 5de590ffaf)
This commit is contained in:
@@ -272,6 +272,7 @@ wxMSW
|
||||
|
||||
wxOSX:
|
||||
|
||||
- Fix crash on startup when using Farsi as system language (#25561).
|
||||
- Do not activate "Close" button on Cmd-C (nobugshere, #25346).
|
||||
|
||||
|
||||
|
||||
@@ -306,7 +306,12 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||
return false;
|
||||
|
||||
#if wxUSE_INTL
|
||||
wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
|
||||
// Check if we recognize the system encoding. Note that we must not call
|
||||
// SetDefaultEncoding() if we don't, as indicated by wxFONTENCODING_DEFAULT
|
||||
// being returned, as SetDefaultEncoding() would assert in this case.
|
||||
const wxFontEncoding defaultEncoding = wxLocale::GetSystemEncoding();
|
||||
if ( defaultEncoding != wxFONTENCODING_DEFAULT )
|
||||
wxFont::SetDefaultEncoding(defaultEncoding);
|
||||
#endif
|
||||
|
||||
// these might be the startup dirs, set them to the 'usual' dir containing the app bundle
|
||||
|
||||
Reference in New Issue
Block a user