mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Fix couple of crashes in main window.
This commit is contained in:
parent
4e57ce8dbb
commit
a389a1e468
1 changed files with 16 additions and 4 deletions
|
@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "intro/intro_widget.h"
|
#include "intro/intro_widget.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "main/main_account.h" // Account::sessionValue.
|
#include "main/main_account.h" // Account::sessionValue.
|
||||||
|
#include "main/main_domain.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "boxes/add_contact_box.h"
|
#include "boxes/add_contact_box.h"
|
||||||
|
@ -636,9 +637,9 @@ void MainWindow::updateTrayMenu(bool force) {
|
||||||
void MainWindow::onShowAddContact() {
|
void MainWindow::onShowAddContact() {
|
||||||
if (isHidden()) showFromTray();
|
if (isHidden()) showFromTray();
|
||||||
|
|
||||||
if (const auto session = account().maybeSession()) {
|
if (const auto controller = sessionController()) {
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<AddContactBox>(session),
|
Box<AddContactBox>(&controller->session()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -770,7 +771,7 @@ void MainWindow::toggleDisplayNotifyFromTray() {
|
||||||
Ui::show(Box<InformBox>(tr::lng_passcode_need_unblock(tr::now)));
|
Ui::show(Box<InformBox>(tr::lng_passcode_need_unblock(tr::now)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!account().sessionExists()) {
|
if (!sessionController()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,7 +826,18 @@ void MainWindow::closeEvent(QCloseEvent *e) {
|
||||||
App::quit();
|
App::quit();
|
||||||
} else {
|
} else {
|
||||||
e->ignore();
|
e->ignore();
|
||||||
if (!account().sessionExists() || !hideNoQuit()) {
|
const auto hasAuth = [&] {
|
||||||
|
if (!Core::App().domain().started()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (const auto &[_, account] : Core::App().domain().accounts()) {
|
||||||
|
if (account->sessionExists()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}();
|
||||||
|
if (!hasAuth || !hideNoQuit()) {
|
||||||
App::quit();
|
App::quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue