Repository navigation
HMS: don't take a plain wxApp for GUI_App (slic3rutils_tests --order rand crash) - #651
Merged
Merged
Conversation
slic3rutils_tests crashed in hms_lookup_tests.cpp under --order rand. HMS.cpp guarded wxGetApp() with wxApp::GetInstance(), but the dark-mode window tests start a plain wxApp, and wxGetApp() static-casts it to GUI_App, so app_config was read from past the end of the object. Any HMS lookup that ran after one of those tests crashed. Read the config through a dynamic_cast instead, restore data_dir when the HMS fixture ends, and add a case that runs the lookups under a plain wxApp. Deft
Owner
Author
|
Windows verification (edgebuild, |
aceRage
marked this pull request as ready for review
October 20, 2026 19:51
aceRage
added a commit
that referenced
this pull request
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
slic3rutils_tests --order randcrashed with SIGSEGV inhms_lookup_tests.cpp(seeds 1/2/3, at lines 326/326/203). HMS.cpp read the app config aswxApp::GetInstance() ? wxGetApp().app_config : nullptr.dark_mode_background_tests.cpp(Windows-only) starts a plainwxApp, andwxGetApp()static-casts it toGUI_App, soapp_configcame from past the end of awxApp. Any HMS lookup that ran after that test (describe_error→hms_language_code) dereferenced garbage. In default order the HMS cases run first, so they passed.Fix
HMS.cpp: newgui_app_config_or_null()(dynamic_cast<GUI_App*>) replaces the three guarded reads (hms_language_code,query_print_error_url_action,init_hms_info).hms_lookup_tests.cpp:FixtureTablesnow restoresdata_dir()on teardown. It used to leave it pointing at a deleted temp dir.wxAppand runs the lookups. Without the fix it crashes deterministically.The unguarded
wxGetApp()calls on the cloud-fetch paths are unchanged. Tests don't reach them (local_only), and in the app they only run under GUI_App.Verification
--order rand): all tests passed. The Mac doesn't run the dark-mode test, so this run doesn't cover the crash.--order rand --rng-seed 1/2/3/42): results to follow in a comment.