Repository navigation
Port Snapmaker/OrcaSlicer #1004: stop backup thread wxPostEvent after shutdown - #475
Merged
Merged
Conversation
…ent after shutdown Serialize m_post_callback swaps against the worker's in-flight invoke so set_backup_callback(nullptr) cannot leave a stale MainFrame lambda to wxPostEvent into a destroyed frame. Re-announce queued ui tasks when a fresh callback is installed so language-switch recreate does not stall auto-backup. Coverage lives in existing test_3mf.cpp (Catch2 v2). Co-authored-by: aceRage <aceRage@users.noreply.github.com>
Resolve tests/libslic3r/test_3mf.cpp: keep both appended test blocks. Deft
The backup manager is a process-wide singleton, so leftover ui tasks can make the first announcement arrive before the test's own Backup task is queued. Consume until the backup response (action 1) is seen instead of assuming one pass. Deft
aceRage
marked this pull request as ready for review
October 14, 2026 09:17
This was referenced Oct 14, 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.
Description
Port of Snapmaker/OrcaSlicer #1004 onto Edge
main.Upstream head SHA ported:
4f3e868732eef29a6372ecef0888b53a41361515(open, unmerged; may still change).Edge branch head:
53d3288785cd050bea2f324c5a763384cacff3e7Edge base:
83267707adc757e9ca1f2e1c946084768cef1d41(main)The backup worker (
_BBS_Backup_Manager::operator()) used to snapshotm_post_callbackunderm_mutex, drop the lock forprocess_task(), then invoke the stale copy.MainFrame::shutdown()— on quit and on language-switch recreate — callsset_backup_callback(nullptr)and destroys the frame. If that lands in the unlocked window, the workerwxPostEvents into a destroyedMainFrame(Sentry SNAPMAKER_ORCA-7R / #7134242393, EXC_BAD_ACCESS).This port:
m_post_callback_mutexso callback swaps serialize against in-flight invokes (lock orderm_mutex→m_post_callback_mutex).m_post_callbackat fire time instead of using a stale local.m_ui_tasksso language-switch recreate does not stall auto-backup (EVT_BACKUP_POSTis edge-triggered onsize()==1).No public API change.
process_ui_task()’s UI-threadcallback(1)path is unchanged (same thread as the only writer).Adapted, not cherry-picked: Edge
bbs_3mf.cppline numbers and Snapmaker extras around the worker are left as-is; only the callback swap/invoke path is touched.Screenshots/Recordings/Graphs
N/A — shutdown race in the backup worker, no UI layout change.
Tests
Catch2 v2 in existing
tests/libslic3r/test_3mf.cpp([3mf][bbs-backup]). Upstream’s newtest_bbs_backup.cpp+tests/libslic3r/CMakeLists.txtedit were not ported (Edge: existing test files only, no test CMake edits). Converted from Catch2 v3 (catch_test_macros.hpp) to v2 (catch.hpp).This cloud VM has no slicer deps/
libslic3r_testsbinary, so the case was not executed here. Edge CI is the gate.Manual smoke (owed on a built app)
.3mfunder the project backup path after a period of edits.