Bug 483757 - KFileWidget creation quits QApplication
Summary: KFileWidget creation quits QApplication
Status: RESOLVED INTENTIONAL
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 6.0.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-03-16 12:38 UTC by wolf.seifert
Modified: 2024-03-17 05:23 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Reproducer: kfilewidget.cpp and qfiledialog.cpp + CMakeLists.txt (1.00 KB, application/zip)
2024-03-16 12:38 UTC, wolf.seifert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wolf.seifert 2024-03-16 12:38:55 UTC
Created attachment 167323 [details]
Reproducer: kfilewidget.cpp and qfiledialog.cpp + CMakeLists.txt

SUMMARY
***
After creation of a KFileWidget the QApplication will be closed (i.e. QApplication::exec() will entered and left again). The same happens for QFileDialog if native dialogs are used. When qt dialogs are used the program stays in QApplication::exec()  (for further event processing).
***

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

OBSERVED RESULT
The program exits.

EXPECTED RESULT
The program should keep on running.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Graphic Platform: Wayland
Comment 1 Antonio Rojas 2024-03-16 16:17:49 UTC

*** This bug has been marked as a duplicate of bug 483439 ***
Comment 2 Nicolas Fella 2024-03-17 00:47:24 UTC
Your program terminates because it has no windows of its own, so when the last QEventLoopLocker goes away the event loop exits. KFileWidget internally uses QEventLoopLocker, so creating it triggers this behavior.

Use QApplication::setQuitLockEnabled(false) to prevent this.
Comment 3 wolf.seifert 2024-03-17 05:23:48 UTC
Thanks!