Bug 484217

Summary: KDE native program continues to run although setQuitOnLastWindowClosed is true
Product: [Frameworks and Libraries] frameworks-kio Reporter: wolf.seifert
Component: Open/save dialogsAssignee: KIO Bugs <kio-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kdelibs-bugs-null
Priority: NOR    
Version First Reported In: 6.0.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: qfiledialog.cpp + CMakeLists.txt

Description wolf.seifert 2024-03-22 07:38:35 UTC
Created attachment 167589 [details]
qfiledialog.cpp + CMakeLists.txt

SUMMARY
***
After closing the QFileDialog the program should terminate because QGuiApplication::setQuitOnLastWindowClosed(true) by default. But the program continues to run.
When using QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs) (i.e. qt dialogs) the program behaves as expected: it quits if setQuitOnLastWindowClosed(true), it continues if setQuitOnLastWindowClosed(false).
***


STEPS TO REPRODUCE
1. Unzip the attached qfiledialog.zip
2. Build with cmake
3. Run the program

OBSERVED RESULT
After closing the dialog the program continues to run.

EXPECTED RESULT
After closing the dialog the program should terminate.
Native and non-native dialogs should behave consistent.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.0.0
Graphic Platform: Wayland
Comment 1 wolf.seifert 2024-03-24 04:46:00 UTC
Deleting these lines

    // eventLoopLocker prevents QCoreApplication from exiting when the last
    // window is closed until the job has finished running
    QEventLoopLocker eventLoopLocker;

from kjob_p.h resolved this issue.

See also https://bugs.kde.org/show_bug.cgi?id=483439#c16
Comment 2 wolf.seifert 2024-05-04 06:46:03 UTC
It was fixed as a side-effect of fixing https://bugreports.qt.io/browse/QTBUG-124386.