Skip to content

HMS: don't take a plain wxApp for GUI_App (slic3rutils_tests --order rand crash) - #651

Merged
aceRage merged 1 commit into
mainfrom
fix/hms-test-order
Oct 20, 2026
Merged

aceRage merged 1 commit into
mainfrom
fix/hms-test-order

Conversation

@aceRage

@aceRage aceRage commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Cause

slic3rutils_tests --order rand crashed with SIGSEGV in hms_lookup_tests.cpp (seeds 1/2/3, at lines 326/326/203). HMS.cpp read the app config as wxApp::GetInstance() ? wxGetApp().app_config : nullptr. dark_mode_background_tests.cpp (Windows-only) starts a plain wxApp, and wxGetApp() static-casts it to GUI_App, so app_config came from past the end of a wxApp. 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: new gui_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: FixtureTables now restores data_dir() on teardown. It used to leave it pointing at a deleted temp dir.
  • New case "a plain wxApp is not taken for the slicer's app" installs a plain wxApp and 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

  • edgebuild 363 (Mac, --order rand): all tests passed. The Mac doesn't run the dark-mode test, so this run doesn't cover the crash.
  • edgebuild 364–367 (Windows, --order rand --rng-seed 1/2/3/42): results to follow in a comment.

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
@aceRage

aceRage commented Oct 20, 2026

Copy link
Copy Markdown
Owner Author

Windows verification (edgebuild, slic3rutils_tests --order rand --rng-seed N): all four pass with 1319 cases. Jobs: 364 seed 1 (local), 365 seed 2 (vm), 366 seed 3 (vm), 367 seed 42 (vm). Each log shows the dark-mode test (the one that starts the plain wxApp) running before at least one HMS case. Seeds 1/2/3 are the ones that crashed on main.

@aceRage
aceRage marked this pull request as ready for review October 20, 2026 19:51
@aceRage
aceRage merged commit 0be84df into main Oct 20, 2026
aceRage added a commit that referenced this pull request Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant