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.
logout should log out...
Similar with me, when i click the logout / reboot /shutdown items, kde will do nothing
I did a bit more digging today and found some messages in my journalctl saying:
kdeinit5: 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.
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.
http://qt-project.org/doc/qt-5/sourcebreaks.html <-- mentions commitData getting deprecated, which explains why our KApplication::commitData isn't getting called.
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.
A fix while the port to QApplication is still happening on https://git.reviewboard.kde.org/r/120427/ which solves the issue here.
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