FIX: fix the crash issue #1944 caused by wronog thread name in some

corner cases

this patch is cherry-picked from PrusaSlicer's 84722876012ca310e29b291e10fef9d18ae26cea
thanks to 'Vojtech Bubnik' for the fix

Implementing a test whether the current thread is the main (UI) thread
and using it on AppConfig::save() to assert if save is called
from a worker thread.
The old assert was using thread names, which did not always work
on Windows.
Fixes #7839 #9178 #9370 #9420
This commit is contained in:
Vojtech Bubnik 2023-02-07 16:17:26 +01:00 committed by Lane.Wei
parent 12eec78d1d
commit 153c9517ce
4 changed files with 33 additions and 14 deletions

View file

@ -393,6 +393,8 @@ int CLI::run(int argc, char **argv)
{
// Mark the main thread for the debugger and for runtime checks.
set_current_thread_name("bambustu_main");
// Save the thread ID of the main thread.
save_main_thread_id();
#ifdef __WXGTK__
// On Linux, wxGTK has no support for Wayland, and the app crashes on