From d84a211b919aa0c92a495412b3673fe43fa95f1e Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sun, 26 Jul 2026 22:15:45 +0800 Subject: [PATCH] fix crashes when switching bbl printers --- src/slic3r/GUI/wxMediaCtrl2.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/wxMediaCtrl2.cpp b/src/slic3r/GUI/wxMediaCtrl2.cpp index 2c4b789e12..f2d1d2701e 100644 --- a/src/slic3r/GUI/wxMediaCtrl2.cpp +++ b/src/slic3r/GUI/wxMediaCtrl2.cpp @@ -602,6 +602,12 @@ WXLRESULT wxMediaCtrl2::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { + // The stream source sends WM_USER+1000 with a synchronous SendMessage from its own threads, + // so this runs re-entrantly on the UI thread at whatever message-retrieval point the player + // happens to be in - often nested inside an Orca log statement. Never BOOST_LOG_TRIVIAL here: + // boost::log is not re-entrant on one thread, and doing so corrupted its per-thread record + // state, crashing later in unrelated places (the player, the log filter, a plug-in heap free). + // Post the string out (as the stat branch does) and log it on a clean stack instead. if (nMsg == WM_USER + 1000) { wxString msg((wchar_t const *) lParam); if (wParam == 1) { @@ -619,7 +625,6 @@ WXLRESULT wxMediaCtrl2::MSWWindowProc(WXUINT nMsg, wxPostEvent(this, evt); } } - BOOST_LOG_TRIVIAL(trace) << msg.ToUTF8().data(); return 0; } return wxMediaCtrl::MSWWindowProc(nMsg, wParam, lParam);