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

View file

@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h" #include "facades.h"
#include "app.h" #include "app.h"
#include <QtGui/QSessionManager>
#include <QtGui/QScreen> #include <QtGui/QScreen>
namespace Core { 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()) { if (cManyInstance()) {
LOG(("Many instance allowed, starting...")); LOG(("Many instance allowed, starting..."));
singleInstanceChecked(); singleInstanceChecked();