mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Fix possible crash in notifications setup.
Initial _account assignment triggered sync createManager(), which in case of native Windows notifications called ToastNotificationManager::CreateToastNotifier, which could enter qt-wndproc-message processing with QEvent::ApplicationActivated delivery and calling updateNonIdle() which called Window::Controller::account(), that wasn't yet set.
This commit is contained in:
parent
e02b60d8fa
commit
615ad85d26
2 changed files with 6 additions and 3 deletions
|
@ -32,11 +32,13 @@ Domain::Domain(const QString &dataName)
|
|||
: _dataName(dataName)
|
||||
, _local(std::make_unique<Storage::Domain>(this, dataName)) {
|
||||
_active.changes(
|
||||
) | rpl::take(1) | rpl::start_with_next([] {
|
||||
) | rpl::take(1) | rpl::start_with_next([=] {
|
||||
// In case we had a legacy passcoded app we start settings here.
|
||||
Core::App().startSettingsAndBackground();
|
||||
|
||||
Core::App().notifications().createManager();
|
||||
crl::on_main(this, [=] {
|
||||
Core::App().notifications().createManager();
|
||||
});
|
||||
}, _lifetime);
|
||||
|
||||
_active.changes(
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#pragma once
|
||||
|
||||
#include "base/timer.h"
|
||||
#include "base/weak_ptr.h"
|
||||
|
||||
namespace Storage {
|
||||
class Domain;
|
||||
|
@ -23,7 +24,7 @@ namespace Main {
|
|||
class Account;
|
||||
class Session;
|
||||
|
||||
class Domain final {
|
||||
class Domain final : public base::has_weak_ptr {
|
||||
public:
|
||||
struct AccountWithIndex {
|
||||
int index = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue