Bug 339187 - Logout (and shutdown, reboot) close plasma but don't log out
Summary: Logout (and shutdown, reboot) close plasma but don't log out
Alias: None
Product: ksmserver
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Lubos Lunak
Depends on:
Reported: 2014-09-18 18:25 UTC by Jeremy Whiting
Modified: 2014-09-29 20:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Whiting 2014-09-18 18:25:18 UTC
For the past few weeks (maybe longer) I've noticed that I am unable to logout of a plasma-next session. Logout sometimes fails completely, and other times closes all applications except krunner and gives me a grey background but nothing else.

In debugging I found the logout items in kickoff call ksmserver's logout dbus method, so I tried calling it myself with qdbusviewer.

If I call the method once, plasmashell and such close, but not krunner. If I call it again the session logs out just fine as I expect it to do on the first call.

Also if I logout from kickoff I get the first half of logout, if I then use qdbusviewer to call it a second time it logs out the rest of the way.

Reproducible: Always

Expected Results:  
logout should log out...
Comment 1 Yuking 2014-09-27 04:37:28 UTC
Similar with me, when i click the logout / reboot /shutdown items, kde will do nothing
Comment 2 Jeremy Whiting 2014-09-28 06:18:12 UTC
I did a bit more digging today and found some messages in my journalctl saying:
kdeinit5[9146]: ksmserver: Client  "/usr/local/bin/konversation"  ( 10d068726f000141188100400000091460022 ) canceled shutdown.

So I tried quitting konversation before doing the logout or reboot or shutdown action from the "Application Menu" and found that if konversation isn't running, logout works fine, but if konversation is running it requires being called twice as described in the original post.

I tried to investigate further to see why konversation is cancelling the shutdown but found nothing in the konversation sources about QSessionManager or anything related to ICE messages or session management, so am not sure how/why konversation is doing this.

I tested with other applications that use a KTextBrowser like konversation (ktextbrowser kdelibs4support test) and logout worked fine with that running. I also tested with dolphin and konsole etc. but had no issues with any application besides konversation itself.
Comment 3 Jeremy Whiting 2014-09-29 18:30:02 UTC
Ok, I dove a bit deeper into konversation's code, and I think I found the problem.

Konversation's MainWindow::queryClose checks KUnqueApplication::sessionSaving to decide if it should close or not but KApplication isn't setting it's d->session_saving since QApplication::commitData isn't used anymore (I added a slot to call commitData, connected it to QApplication::commitDataRequest but even then our commitData sets then unsets session_saving before the application gets the queryClose called.

So either kdelibs4support's d->session_saving needs some love so it is set appropriately for applications that still use it to act accordingly, or konversation needs to just use QApplication and ask it if the session manager is closing it, etc.
Comment 4 Jeremy Whiting 2014-09-29 18:49:25 UTC
http://qt-project.org/doc/qt-5/sourcebreaks.html <-- mentions commitData getting deprecated, which explains why our KApplication::commitData isn't getting called.
Comment 5 Eike Hein 2014-09-29 20:00:40 UTC
FWIW we plan to port to QApplication (KUniqueApplication is at this point almost our last kdelibs4support dep) and already have a topic branch for it, it's just taking a bit longer because we're a somewhat more advanced user of that ballpark of classes (e.g. we support in-place self-restarts of the app with CLI argument roundtripping). IMHO trying to fix KApplication is still needed because make no mistake, Konvi will be one of the first apps to drop it - plenty of other apps are still KApps.
Comment 6 Jeremy Whiting 2014-09-29 20:09:57 UTC
A fix while the port to QApplication is still happening on https://git.reviewboard.kde.org/r/120427/ which solves the issue here.
Comment 7 Jeremy Whiting 2014-09-29 20:59:13 UTC
Git commit 93b4fc6073bfdfcd3d7bd466fc2d4cbbadec0445 by Jeremy Whiting.
Committed on 29/09/2014 at 20:03.
Pushed by whiting into branch 'frameworks'.

Fix session quit handling by not using deprecated sessionSaving method.

M  +1    -1    src/mainwindow.cpp