https://bugs.kde.org/show_bug.cgi?id=471941
Bug ID: 471941 Summary: KJob dtor force-quits applications Classification: Frameworks and Libraries Product: frameworks-kcoreaddons Version: unspecified Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: mp...@kde.org Reporter: sit...@kde.org CC: kdelibs-b...@kde.org Target Milestone: --- Created attachment 160072 --> https://bugs.kde.org/attachment.cgi?id=160072&action=edit 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 -- You are receiving this mail because: You are watching all bug changes.