Skip to content

fix safety issue of multiple threads use KConfig in the same process

likai requested to merge (removed):master into master

When multiple threads in the same process (such as kwin_wayland thread and libinput-connection thread in kwin_wayland process) are locking the same local file at the same time by KConfig::sync(), the first thread will create a new lockFile and lock it. Before the thread unlocks the lockFile, the other thread will block here: lockFile->lock(). When the first thread unlocks the lockFile, it will delete lockFile and the lockFile pointer is nullptr. Then, the other blocked thread will unblock and continue to handle the lockFile but it is already deleted and nullptr pointer. This will let the process exit due to null pointer exception.

Merge request reports