2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

ensure that closeApplication() is called only once

This commit is contained in:
John Preston
2016-03-02 20:34:42 +02:00
parent cde264e5a1
commit b277f5cdb7
9 changed files with 35 additions and 37 deletions

View File

@@ -33,7 +33,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "numbers.h"
namespace {
bool quiting = false;
App::LaunchState _launchState = App::Launched;
UserData *self = 0;
@@ -1791,7 +1791,7 @@ namespace App {
}
::repliesTo.erase(j);
}
if (App::main() && !App::quiting()) {
if (App::main() && !App::quitting()) {
App::main()->itemRemoved(item);
}
}
@@ -2155,21 +2155,22 @@ namespace App {
}
void quit() {
if (quiting()) return;
if (quitting()) return;
setLaunchState(QuitRequested);
setQuiting();
if (wnd()) {
wnd()->quit();
}
Application::quit();
}
bool quiting() {
return ::quiting;
bool quitting() {
return _launchState != Launched;
}
void setQuiting() {
::quiting = true;
LaunchState launchState() {
return _launchState;
}
void setLaunchState(LaunchState state) {
_launchState = state;
}
QImage readImage(QByteArray data, QByteArray *format, bool opaque, bool *animated) {