Commit 9e641d41 authored by David Edmundson's avatar David Edmundson
Browse files

Revert "Use new simpler way to disable session management in services"

The two ways of disabling session management have the same impact on the
session being saved, but there is one behavioural side-effect that
turned out to be less ideal.

By disabling completely we don't follow the session manager telling the
application to quit. That's not something needed with the systemd boot,
but for the legacy boot effectively we were just closing applications by
ripping the X connection away from under them.

Some applications are bad at handling this and this led to a bunch of
crashes or dangling processes at logout.

This reverts commit 9be7dedb.

CCBUG: 424408
parent 0a66e92c
......@@ -18,6 +18,7 @@
*/
#include <QGuiApplication>
#include <QSessionManager>
#include <KWindowSystem>
......@@ -28,7 +29,6 @@ int main(int argc, char ** argv)
qputenv("QT_QPA_PLATFORM", "xcb");
QGuiApplication::setDesktopSettingsAware(false);
QCoreApplication::setAttribute(Qt::AA_DisableSessionManager);
QGuiApplication app(argc, argv);
......@@ -36,6 +36,12 @@ int main(int argc, char ** argv)
qFatal("qdbusmenuproxy is only useful XCB. Aborting");
}
auto disableSessionManagement = [](QSessionManager &sm) {
sm.setRestartHint(QSessionManager::RestartNever);
};
QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
app.setQuitOnLastWindowClosed(false);
MenuProxy proxy;
......
......@@ -24,6 +24,7 @@
#include <QUrl>
#include <QDebug>
#include <QQuickWindow>
#include <QSessionManager>
#include <QDBusMessage>
#include <QDBusConnection>
......@@ -41,7 +42,6 @@
int main(int argc, char **argv)
{
QCommandLineParser parser;
QCoreApplication::setAttribute(Qt::AA_DisableSessionManager);
if (!qEnvironmentVariableIsSet("PLASMA_USE_QT_SCALING")) {
qunsetenv("QT_DEVICE_PIXEL_RATIO");
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
......@@ -93,6 +93,14 @@ int main(int argc, char **argv)
KDBusService service(KDBusService::Unique | KDBusService::StartupOption(parser.isSet(replaceOption) ? KDBusService::Replace : 0));
QGuiApplication::setFallbackSessionManagementEnabled(false);
auto disableSessionManagement = [](QSessionManager &sm) {
sm.setRestartHint(QSessionManager::RestartNever);
};
QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
View view;
auto updateVisibility = [&]() {
......
......@@ -21,6 +21,7 @@
#include <QApplication>
#include <QCommandLineParser>
#include <QQuickWindow>
#include <QSessionManager>
#include <QDebug>
#include <QProcess>
#include <QMessageBox>
......@@ -83,7 +84,6 @@ int main(int argc, char *argv[])
} else {
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
}
QCoreApplication::setAttribute(Qt::AA_DisableSessionManager);
QQuickWindow::setDefaultAlphaBuffer(true);
......@@ -162,6 +162,14 @@ int main(int argc, char *argv[])
cliOptions.process(app);
aboutData.processCommandLine(&cliOptions);
QGuiApplication::setFallbackSessionManagementEnabled(false);
auto disableSessionManagement = [](QSessionManager &sm) {
sm.setRestartHint(QSessionManager::RestartNever);
};
QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
ShellCorona* corona = new ShellCorona(&app);
corona->setShell(cliOptions.value(shellPluginOption));
......
......@@ -19,6 +19,7 @@
*/
#include <QGuiApplication>
#include <QSessionManager>
#include "fdoselectionmanager.h"
......@@ -41,7 +42,6 @@ int main(int argc, char ** argv)
qputenv("QT_QPA_PLATFORM", "xcb");
QGuiApplication::setDesktopSettingsAware(false);
QCoreApplication::setAttribute(Qt::AA_DisableSessionManager);
QGuiApplication app(argc, argv);
......@@ -49,6 +49,12 @@ int main(int argc, char ** argv)
qFatal("xembed-sni-proxy is only useful XCB. Aborting");
}
auto disableSessionManagement = [](QSessionManager &sm) {
sm.setRestartHint(QSessionManager::RestartNever);
};
QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
app.setQuitOnLastWindowClosed(false);
qDBusRegisterMetaType<KDbusImageStruct>();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment