Fix occasional crashes in KConfig::sync() during exit

Previously, !637 (merged) (c035e95e) introduced QtConcurrent::run to execute KConfig::sync() in a separate thread. However, this introduced thread-safety issues:

  • BUG 518433 (Race Condition): The main thread may modify the entrymap while saving the session, while the worker thread simultaneously iterates over the same entrymap during sync().
  • BUG 516481 (Maybe Use-After-Free): During closeEvent(), the main thread might destroy objects that the worker thread is still accessing for the sync operation.

Changes:
Move KConfig::sync() back to the main thread to ensure data consistency and prevent memory corruption.

Limitation:
According to the discussion in BUG 425627, users with traditional HDD might notice a UI hang during exit due to synchronous I/O.

BUG: 518433
BUG: 516481
CCBUG: 425627

Merge request reports

Loading
Loading