Crash on Mac when system language is Persian/Farsi (Issue #25561)

14 views
Skip to first unread message

andymrob

unread,
Jun 24, 2025, 8:51:39 AM6/24/25
to wx-...@googlegroups.com, Subscribed
andymrob created an issue (wxWidgets/wxWidgets#25561)

I'm reporting from Ventura 13.7.6 but the issue was first reported to me from someone running Sonoma.

The minimal app crashes immediately on launch when the system language is Persian/Farsi.

To reproduce:

  1. System Settings - Language & Region - add Persian as primary language.
    Mac says something about how the language is not fully supported by macOS,
    and maybe that is related to this problem.

  2. Reboot the computer.

  3. There is a little button at the right of the menu bar for selecting keyboard layout.
    Select a layout which will enable you to type english text in case you want to (e.g. in a terminal).

  4. Run wx minimal app. It crashes immediately. Here is the stack trace from the Mac crash report.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 minimal 0x10b506c04 wxDefaultAssertHandler(wxString const&, int, wxString const&, wxString const&, wxString const&) + 84 (appbase.cpp:1176)
1 minimal 0x10b504103 wxOnAssert(char const*, int, char const*, char const*, wchar_t const*) + 163 (appbase.cpp:1267)
2 minimal 0x10b36d4f3 wxArtProvider::GetBitmap(wxString const&, wxString const&, wxSize const&) + 259 (artprov.cpp:429)
3 minimal 0x10b36e64c wxArtProvider::GetIcon(wxString const&, wxString const&, wxSize const&) + 60 (artprov.cpp:579)
4 minimal 0x10b4c1516 wxArtProvider::GetMessageBoxIcon(int) + 86 (artprov.h:186)
5 minimal 0x10b4c7cfb wxGenericMessageDialog::DoCreateMsgdialog() + 347 (msgdlgg.cpp:173)
6 minimal 0x10b4c856f wxGenericMessageDialog::ShowModal() + 95 (msgdlgg.cpp:271)
7 minimal 0x10b36b2ca wxGUIAppTraitsBase::ShowAssertDialog(wxString const&) + 586 (appcmn.cpp:544)
8 minimal 0x10b5063e4 ShowAssertDialog(wxString const&, int, wxString const&, wxString const&, wxString const&, wxAppTraits*) + 852 (appbase.cpp:1392)
9 minimal 0x10b505fbf wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*) + 191 (appbase.cpp:875)
10 minimal 0x10b5064cc wxAppConsoleBase::OnAssert(wchar_t const*, int, wchar_t const*, wchar_t const*) + 92 (appbase.cpp:894)
11 minimal 0x10b506d58 wxDefaultAssertHandler(wxString const&, int, wxString const&, wxString const&, wxString const&) + 424 (appbase.cpp:1198)
12 minimal 0x10b504103 wxOnAssert(char const*, int, char const*, char const*, wchar_t const*) + 163 (appbase.cpp:1267)
13 minimal 0x10b3ea246 wxFontBase::SetDefaultEncoding(wxFontEncoding) + 86 (fontcmn.cpp:137)
14 minimal 0x10b29582d wxApp::Initialize(int&, wchar_t**) + 301 (app.cpp:300)
15 minimal 0x10b583aa6 wxEntryStart(int&, wchar_t**) + 326 (init.cpp:394)
16 minimal 0x10b5846ab wxInitialize(int&, wchar_t**) + 59 (init.cpp:611)
17 minimal 0x10b5852b9 wxInitializer::wxInitializer(int&, wchar_t**) + 41 (init.h:85)
18 minimal 0x10b5844d5 wxInitializer::wxInitializer(int&, wchar_t**) + 37 (init.h:84)
19 minimal 0x10b58431a wxEntry(int&, wchar_t**) + 186 (init.cpp:546)
20 minimal 0x10b58462d wxEntry(int&, char**) + 61 (init.cpp:590)
21 minimal 0x10b1ea943 main + 35 (minimal.cpp:105)
22 dyld 0x7ff8094b3418 start + 1896

The first assertion from wxFontBase::SetDefaultEncoding(wxFontEncoding) + 86 (fontcmn.cpp:137)
comes from this line:
wxCHECK_RET( encoding != wxFONTENCODING_DEFAULT,
wxT("can't set default encoding to wxFONTENCODING_DEFAULT") );
and in attempting to display a message box the assert handler calls wxArtProvider::GetBitmap at artprov.cpp:429
which triggers an assert-within-an-assert on this line
wxCHECK_MSG( sm_providers, wxNullBitmap, wxT("no wxArtProvider exists") );
which crashes because wxDefaultAssertHandler does a wxTrap() when reentrant use is detected.

I have no idea what the correct solution is, but I have merely commented out
the "wxCHECK_RET( encoding != wxFONTENCODING_DEFAULT..." and it seems to work ok.

Andy Robinson, Seventh String Software, www.seventhstring.com


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25561@github.com>

andymrob

unread,
Jun 24, 2025, 8:58:04 AM6/24/25
to wx-...@googlegroups.com, Subscribed
andymrob left a comment (wxWidgets/wxWidgets#25561)

And I should have said, this is the latest version of wx.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25561/3000384882@github.com>

VZ

unread,
Jun 24, 2025, 10:59:30 AM6/24/25
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25561)

Thanks for reporting!

There are (as usual...) multiple problems here:

  1. wxLocale::GetSystemEncoding() doesn't recognize Farsi encoding (is it kTextEncodingMacFarsi?).
  2. wxApp::Initialize() wrongly calls wxFont::SetDefaultEncoding() without checking that the parameter is valid.
  3. ShowAssertDialog() wrongly uses the assert dialog before the GUI is fully initialized.

(2) is easy to fix, so I'll do it, but it would be nice to fix the other problems as well, of course...


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25561/3000851075@github.com>

VZ

unread,
Jun 24, 2025, 11:22:10 AM6/24/25
to wx-...@googlegroups.com, Subscribed

Closed #25561 as completed via 5de590f.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/25561/issue_event/18297466399@github.com>

Reply all
Reply to author
Forward
0 new messages