Created attachment 160072 [details] example source SUMMARY KJobPrivate has // eventLoopLocker prevents QCoreApplication from exiting when the last // window is closed until the job has finished running QEventLoopLocker eventLoopLocker; The way this works is that each QEventLoopLocker has a refcount in the QCoreApplication, when the counter hits zero the application quits. That means when all kjobs are destroyed the application always quits - regardless of whether it was meant to! I'm going to attach a trivial example. For QGuiApplications this is additionally contingent on its quitOnLastWindowClosed property, but when that is set to false the call chain falls back into QCoreApplication and behaves exactly the same. Put another way: you cannot use KJobs and QGuiApplications that are meant **not** to quit because running out of KJobs always force quits the application. I'm not quite sure what the fix here should be. Maybe install an eventfilter on the QCoreApplication and only install the lockers on QEvent::Quit? Alternatively we could bounce this to Qt since this behavior arguably makes QEventLoopLocker only niche-useful. Someone probably needs to track whether quit was actually called on the application though. SOFTWARE/OS VERSIONS Operating System: KDE neon Unstable Edition KDE Plasma Version: 5.27.80 KDE Frameworks Version: 5.240.0 Qt Version: 6.5.1 Kernel Version: 5.19.0-42-generic (64-bit) Graphics Platform: offscreen Processors: 12 × AMD Ryzen 5 3600X 6-Core Processor Memory: 31.3 GiB of RAM Graphics Processor: AMD Radeon RX 5700 XT ADDITIONAL INFORMATION
The fix is to use QCoreApplication::setQuitLockEnabled(false) on the affected apps
How to inform users of KIO about this?
So Nicolas, is this expected and we need to mention it in the KF5->KF6 porting notes? Or is something we should fix?
Strictly speaking this is a pure Qt thing, it just happens to be triggered by KJob. It's even the case in Qt5 already, the only thing that changed in Qt6 is that setting quitOnLastWindowClosed is not enough to address it any more
*** Bug 493893 has been marked as a duplicate of this bug. ***