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