Skip to content

Commit

Permalink
Initialize locale before wxTranslations::Get()
Browse files Browse the repository at this point in the history
This fixes a crash similar to <prusa3d/PrusaSlicer#8299>.
  • Loading branch information
zhaofengli authored and DzzD committed Sep 24, 2023
1 parent c2d6265 commit 1ae9bb4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/slic3r/GUI/GUI_App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4766,6 +4766,7 @@ bool GUI_App::load_language(wxString language, bool initial)
{
// Allocating a temporary locale will switch the default wxTranslations to its internal wxTranslations instance.
wxLocale temp_locale;
temp_locale.Init();
// Set the current translation's language to default, otherwise GetBestTranslation() may not work (see the wxWidgets source code).
wxTranslations::Get()->SetLanguage(wxLANGUAGE_DEFAULT);
// Let the wxFileTranslationsLoader enumerate all translation dictionaries for PrusaSlicer
Expand Down

0 comments on commit 1ae9bb4

Please sign in to comment.