Loading
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
entrymapwhile saving the session, while the worker thread simultaneously iterates over the sameentrymapduringsync(). - BUG 516481 (Maybe Use-After-Free): During
closeEvent(), the main thread might destroy objects that the worker thread is still accessing for thesyncoperation.
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.