mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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)
|
: _dataName(dataName)
|
||||||
, _local(std::make_unique<Storage::Domain>(this, dataName)) {
|
, _local(std::make_unique<Storage::Domain>(this, dataName)) {
|
||||||
_active.changes(
|
_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.
|
// In case we had a legacy passcoded app we start settings here.
|
||||||
Core::App().startSettingsAndBackground();
|
Core::App().startSettingsAndBackground();
|
||||||
|
|
||||||
Core::App().notifications().createManager();
|
crl::on_main(this, [=] {
|
||||||
|
Core::App().notifications().createManager();
|
||||||
|
});
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
|
|
||||||
_active.changes(
|
_active.changes(
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
|
#include "base/weak_ptr.h"
|
||||||
|
|
||||||
namespace Storage {
|
namespace Storage {
|
||||||
class Domain;
|
class Domain;
|
||||||
|
@ -23,7 +24,7 @@ namespace Main {
|
||||||
class Account;
|
class Account;
|
||||||
class Session;
|
class Session;
|
||||||
|
|
||||||
class Domain final {
|
class Domain final : public base::has_weak_ptr {
|
||||||
public:
|
public:
|
||||||
struct AccountWithIndex {
|
struct AccountWithIndex {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue