qtkeychain icon indicating copy to clipboard operation
qtkeychain copied to clipboard

Prevent race on applications quitting whilst save jobs are in process

Open davidedmundson opened this issue 2 years ago • 2 comments

If an application calls quit or closes all windows we still want to finish saving the password. Qt provides a mechanism to defer the exit whilst jobs are active.

This brings us in line with KDE's KJob.

Note this change can cause a niche behavioural change with QCoreApplication applications that incorrectly have with quit loop enabled and use the main event loop so should probably not be backported.

davidedmundson avatar Oct 01 '22 12:10 davidedmundson

Wouldn't this break when using Qtkeychain jobs outside the main thread?

frankosterfeld avatar Oct 01 '22 12:10 frankosterfeld

Good question.

It would hold a lock on the application. holding a lock on the app (QCoreApplicationPrivate::ref) is thread safe. It won't break.

But it doesn't protect the thread case, one could still kill a thread with an active job, though I would say that's the caller's responsibility?

davidedmundson avatar Oct 01 '22 15:10 davidedmundson