mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Always make sure that settings are saved.
This commit is contained in:
@@ -152,6 +152,10 @@ Application::Application(not_null<Launcher*> launcher)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
if (_saveSettingsTimer && _saveSettingsTimer->isActive()) {
|
||||||
|
Local::writeSettings();
|
||||||
|
}
|
||||||
|
|
||||||
// Depend on activeWindow() for now :(
|
// Depend on activeWindow() for now :(
|
||||||
Shortcuts::Finish();
|
Shortcuts::Finish();
|
||||||
|
|
||||||
@@ -465,7 +469,9 @@ bool Application::eventFilter(QObject *object, QEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Application::saveSettingsDelayed(crl::time delay) {
|
void Application::saveSettingsDelayed(crl::time delay) {
|
||||||
_saveSettingsTimer.callOnce(delay);
|
if (_saveSettingsTimer) {
|
||||||
|
_saveSettingsTimer->callOnce(delay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::saveSettings() {
|
void Application::saveSettings() {
|
||||||
@@ -533,7 +539,7 @@ void Application::badMtprotoConfigurationError() {
|
|||||||
|
|
||||||
void Application::startLocalStorage() {
|
void Application::startLocalStorage() {
|
||||||
Local::start();
|
Local::start();
|
||||||
_saveSettingsTimer.setCallback([=] { saveSettings(); });
|
_saveSettingsTimer.emplace([=] { saveSettings(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::startEmojiImageLoader() {
|
void Application::startEmojiImageLoader() {
|
||||||
|
@@ -368,7 +368,7 @@ private:
|
|||||||
crl::time _shouldLockAt = 0;
|
crl::time _shouldLockAt = 0;
|
||||||
base::Timer _autoLockTimer;
|
base::Timer _autoLockTimer;
|
||||||
|
|
||||||
base::Timer _saveSettingsTimer;
|
std::optional<base::Timer> _saveSettingsTimer;
|
||||||
|
|
||||||
struct LeaveSubscription {
|
struct LeaveSubscription {
|
||||||
LeaveSubscription(
|
LeaveSubscription(
|
||||||
|
Reference in New Issue
Block a user