Disable restart on session start explicitly

This commit is contained in:
Ilya Fedin 2020-06-20 21:47:02 +04:00 committed by John Preston
parent 06a4480520
commit 2743aee614
1 changed files with 14 additions and 0 deletions

View File

@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "app.h"
#include <QtGui/QSessionManager>
#include <QtGui/QScreen>
namespace Core {
@ -132,6 +133,19 @@ int Sandbox::start() {
});
});
// https://github.com/telegramdesktop/tdesktop/issues/948
// and https://github.com/telegramdesktop/tdesktop/issues/5022
const auto restartHint = [](QSessionManager &manager) {
manager.setRestartHint(QSessionManager::RestartNever);
};
connect(
this,
&QGuiApplication::saveStateRequest,
this,
restartHint,
Qt::DirectConnection);
if (cManyInstance()) {
LOG(("Many instance allowed, starting..."));
singleInstanceChecked();