Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch: Locale related crash on startup (Arch build from source) #235

Closed
pfrench42 opened this issue Jan 25, 2023 · 13 comments
Closed

patch: Locale related crash on startup (Arch build from source) #235

pfrench42 opened this issue Jan 25, 2023 · 13 comments
Labels
bug Something isn't working stale

Comments

@pfrench42
Copy link

pfrench42 commented Jan 25, 2023

Describe the bug
After build from source, app crashes before main window comes up, every time.

To Reproduce
Compile the program from source.
run the program it crashes while loading the locale, before the UI comes up

Expected behavior
Main application window should come up

Screenshots
This is the backtrace of the segfault
Notice in frame #3, linux_get_existing_locale_laguage is being passed NULL for system_language, and crashes when doing member accesses of system_language

This is called from GUI_App::load_language() where m_language_info_system is NULL
language_info = linux_get_existing_locale_language(language_info, m_language_info_system);
(gdb) bt

#0  std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::find(wchar_t, unsigned long) const (this=0x8, __c=95 L'_', __pos=0)
    at /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:687
#1  0x000055555984cd7f in wxString::Find(wxUniChar, bool) const ()
#2  0x000055555984cf9e in wxString::AfterFirst(wxUniChar) const ()
#3  0x0000555556d0a6b5 in Slic3r::GUI::linux_get_existing_locale_language(wxLanguageInfo const*, wxLanguageInfo const*) (language=0x55555c515800, system_language=0x0)
    at /home/bak/pfrench/git/3dprint/BambuStudio-SoftFever/src/slic3r/GUI/GUI_App.cpp:4282
#4  0x0000555556d0caa2 in Slic3r::GUI::GUI_App::load_language(wxString, bool) (this=0x55555c299f30, language=..., initial=true)
    at /home/bak/pfrench/git/3dprint/BambuStudio-SoftFever/src/slic3r/GUI/GUI_App.cpp:4499
#5  0x0000555556cf8cba in Slic3r::GUI::GUI_App::on_init_inner() (this=0x55555c299f30) at /home/bak/pfrench/git/3dprint/BambuStudio-SoftFever/src/slic3r/GUI/GUI_App.cpp:2116
#6  0x0000555556cf6faf in Slic3r::GUI::GUI_App::OnInit() (this=0x55555c299f30) at /home/bak/pfrench/git/3dprint/BambuStudio-SoftFever/src/slic3r/GUI/GUI_App.cpp:2009
#7  0x000055555981ab53 in wxEntry(int&, wchar_t**) ()
#8  0x0000555556ce671c in Slic3r::GUI::GUI_Run(Slic3r::GUI::GUI_InitParams&) (params=...) at /home/bak/pfrench/git/3dprint/BambuStudio-SoftFever/src/slic3r/GUI/GUI_Init.cpp:64
#9  0x0000555555cb307e in Slic3r::CLI::run(int, char**) (this=0x7fffffffd620, argc=1, argv=0x7fffffffd858) at /home/bak/pfrench/git/3dprint/BambuStudio-SoftFever/src/BambuStudio.cpp:452
#10 0x0000555555cc980e in main(int, char**) (argc=1, argv=0x7fffffffd858) at /home/bak/pfrench/git/3dprint/BambuStudio-SoftFever/src/BambuStudio.cpp:2623

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

@pfrench42 pfrench42 added the bug Something isn't working label Jan 25, 2023
@pfrench42
Copy link
Author

patch which fixed this for me:

diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index 3948589b..d830229a 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -4496,6 +4496,9 @@ bool GUI_App::load_language(wxString language, bool initial)
     // instead of just reporting that it is impossible to switch.
     if (! wxLocale::IsAvailable(language_info->Language)) {
         std::string original_lang = into_u8(language_info->CanonicalName);
+        if ( nullptr == m_language_info_system ) {
+            m_language_info_system = wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
+        }
         language_info = linux_get_existing_locale_language(language_info, m_language_info_system);
         BOOST_LOG_TRIVIAL(trace) << boost::format("Can't switch language to %1% (missing locales). Using %2% instead.")
                                     % original_lang % language_info->CanonicalName.ToUTF8().data();

@pfrench42 pfrench42 changed the title Locale related crash on startup (Arch build from source) Locale related crash on startup (Arch build from source, patch included) Jan 25, 2023
@pfrench42 pfrench42 changed the title Locale related crash on startup (Arch build from source, patch included) patch: Locale related crash on startup (Arch build from source) Jan 25, 2023
@SoftFever
Copy link
Owner

SoftFever commented Jan 26, 2023

Great. Thanks
Do you plan to create a PR for the fix?

@pfrench42
Copy link
Author

I was not planning to. I've not even created a fork of my own.
Great SW, BTW, thanks for doing this.
If you want me to fork and submit I'll do it but this was a pretty small change.

@woolmonkey
Copy link

Any help on compiling it? Keep trying and it stops with errors all the time.

@pwhelan
Copy link

pwhelan commented Aug 8, 2023

Does this still need to be merged?

@pfrench42
Copy link
Author

pfrench42 commented Aug 10, 2023 via email

@pwhelan
Copy link

pwhelan commented Aug 10, 2023

I'd love to see it merged. As-is the AppImage crashes every time on my Arch distro

I was able to fix it by setting my language manually .config/OrcaSlicer/OrcaSlicer.conf. I cannot recall or even find where I set it. You could try erasing that configuration file and seeing if then it can execute correctly. It was set to en_GB for me which caused it to probably caused it to crash since my locale is en_US.

@SoftFever
Copy link
Owner

A patch has been submitted based on this.
Let me know if it fixes the issue.
The build will be ready in about half an hour: https://github.com/SoftFever/OrcaSlicer/actions/runs/5827305845

patch which fixed this for me:

diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index 3948589b..d830229a 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -4496,6 +4496,9 @@ bool GUI_App::load_language(wxString language, bool initial)
     // instead of just reporting that it is impossible to switch.
     if (! wxLocale::IsAvailable(language_info->Language)) {
         std::string original_lang = into_u8(language_info->CanonicalName);
+        if ( nullptr == m_language_info_system ) {
+            m_language_info_system = wxLocale::GetLanguageInfo(wxLANGUAGE_DEFAULT);
+        }
         language_info = linux_get_existing_locale_language(language_info, m_language_info_system);
         BOOST_LOG_TRIVIAL(trace) << boost::format("Can't switch language to %1% (missing locales). Using %2% instead.")
                                     % original_lang % language_info->CanonicalName.ToUTF8().data();

SoftFever added a commit that referenced this issue Aug 11, 2023
@pwhelan
Copy link

pwhelan commented Aug 16, 2023

It works for me.

@pfrench42
Copy link
Author

pfrench42 commented Aug 16, 2023 via email

@pfrench42
Copy link
Author

pfrench42 commented Aug 16, 2023 via email

Copy link

GitHub bot: this issue is stale because it has been open for 90 days with no activity.

@github-actions github-actions bot added the stale label Nov 17, 2023
Copy link

GitHub bot: This issue was closed because it has been inactive for 7 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

4 participants