https://bugs.kde.org/show_bug.cgi?id=524863
Bug ID: 524863
Summary: Background Apps "Quit" hard-kills Flatpak apps that do
not implement org.freedesktop.Application, destroying
session state
Classification: Plasma
Product: plasmashell
Version First 6.7.4
Reported In:
Platform: Fedora RPMs
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: System Tray widget
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: 1.0
If you quit a Flatpak app from the System Tray's "Background Apps" entry,
Plasma
kills it with SIGKILL rather than asking it to shut down. With Google Chrome
that
loses the session. Chrome writes exit_type: "Crashed" and offers to restore
pages
the next time you open it.
Chrome exits cleanly on SIGTERM, so the hard kill isn't needed.
In applets/systemtray/systemtraymodel.cpp the widget calls
org.freedesktop.Application.quit on the app's D-Bus name. If that errors it
goes
straight to `flatpak kill`:
auto message = QDBusMessage::createMethodCall(app.appId,
appIdToDBusPath(app.appId),
"org.freedesktop.Application"_L1, "quit"_L1);
...
if (watcher->isError()) {
qCInfo(SYSTEM_TRAY) << "Failed to terminate background app via dbus:"
<< watcher->error();
for (const auto &instance : std::as_const(instances)) {
auto job = new KIO::CommandLauncherJob("flatpak"_L1, {"kill"_L1,
instance});
com.google.Chrome doesn't implement that interface. There's
no DBusActivatable key in its .desktop file. So the D-Bus call fails every time
and the kill always runs.
STEPS TO REPRODUCE
==================
1. flatpak install flathub com.google.Chrome, open it, leave background mode on
(is the default)
2. Close Chrome window (do not hard exit), then quit it from system tray by
right clicking the chrome icon
3. Look at profile.exit_type in
~/.var/app/com.google.Chrome/config/google-chrome/Default/Preferences
OBSERVED RESULT
===============
exit_type is "Crashed" and Chrome asks to restore pages on the next launch.
plasmashell[3676]: Failed to terminate background app via dbus:
QDBusError("org.freedesktop.DBus.Error.ServiceUnknown", "The name is not
activatable")
systemd[3216]: [email protected]: Main process exited,
code=exited, status=137/n/a
137 means SIGKILL.
EXPECTED RESULT
===============
A clean shutdown.
SOFTWARE/OS VERSIONS
====================
Operating System: Aurora 44
KDE Plasma Version: 6.7.4
KDE Frameworks Version: 6.29.0
Qt Version: 6.11.1
Kernel Version: 7.1.6-201.fc44.x86_64 (64-bit)
Graphics Platform: Wayland
ADDITIONAL INFORMATION
======================
All three ways of stopping Chrome, for comparison:
Chrome's own menu, Exit -> exit_type: Normal
kill -TERM <chrome pid> -> exit_type: SessionEnded
Background Apps -> Quit -> exit_type: Crashed
Since SIGTERM works, the fallback could check for DBusActivatable=true before
trying D-Bus at all, then send SIGTERM, and only use `flatpak kill` if the
process is still running after a timeout.
This only affects Flatpak apps. The fallback loops over app.flatpakInstances,
which is empty for native packages, so with those the failed D-Bus call does
nothing and Quit has no effect at all.
--
You are receiving this mail because:
You are watching all bug changes.