Enhancement: eliminate UI freeze during cloud preset sync on startup (#13673)

fix: eliminate UI freeze during cloud preset sync on startup
  Move synchronous HTTP calls off the main thread in
  GUI_App::start_sync_user_preset():

  - Call scan_orphaned_info_files() and process_delete_presets() in
    the background sync thread instead of the UI thread, so their
    HTTP DELETE calls don't block startup.
  - Call reload_settings() directly from the background thread
    instead of via CallAfter, so get_user_presets() (HTTP GET) and
    load/save_user_presets (file I/O) run off the main thread.
  - Guard update_side_preset_ui() and app_config->save() with
    is_main_thread_active() / CallAfter so they're safe when called
    from a worker thread.
  - Simplifiy finishFn lambdas: the progress-dialog case only
    destroys the dialog; the no-dialog case is a no-op.
This commit is contained in:
SoftFever
2026-05-15 19:45:24 +08:00
committed by GitHub
parent cf0dfd12ce
commit 2167378bbe
2 changed files with 24 additions and 21 deletions

View File

@@ -834,8 +834,10 @@ std::string AppConfig::load()
void AppConfig::save()
{
if (! is_main_thread_active())
if (!is_main_thread_active()) {
BOOST_LOG_TRIVIAL(fatal) << "Calling AppConfig::save() from a worker thread!";
throw CriticalException("Calling AppConfig::save() from a worker thread!");
}
// The config is first written to a file with a PID suffix and then moved
// to avoid race conditions with multiple instances of Slic3r