Fix crash in notifications clearing.

This commit is contained in:
John Preston 2020-06-30 19:33:22 +04:00
parent d529c60081
commit 41f2cc6d81
3 changed files with 7 additions and 5 deletions

View File

@ -153,6 +153,7 @@ Application::~Application() {
_window = nullptr;
_mediaView = nullptr;
_notifications->clearAllFast();
_domain->finish();
Local::finish();

View File

@ -331,6 +331,11 @@ private:
base::Timer _clearEmojiImageLoaderTimer;
const std::unique_ptr<Media::Audio::Instance> _audio;
mutable std::unique_ptr<MTP::Config> _fallbackProductionConfig;
// Notifications should be destroyed before _audio, after _domain.
// Mutable because is created in run() after OpenSSL is inited.
std::unique_ptr<Window::Notifications::System> _notifications;
const std::unique_ptr<Main::Domain> _domain;
const std::unique_ptr<Export::Manager> _exportManager;
const std::unique_ptr<Calls::Instance> _calls;
@ -347,10 +352,6 @@ private:
Media::Player::FloatDelegate *_defaultFloatPlayerDelegate = nullptr;
Media::Player::FloatDelegate *_replacementFloatPlayerDelegate = nullptr;
// Notifications should be destroyed before _audio.
// Mutable because is created in run() after OpenSSL is inited.
std::unique_ptr<Window::Notifications::System> _notifications;
const QImage _logo;
const QImage _logoNoMargin;

View File

@ -192,7 +192,7 @@ void Manager::showNextFromQueue() {
return;
}
int count = Core::App().settings().notificationsCount();
for_const (auto &notification, _notifications) {
for (const auto &notification : _notifications) {
if (notification->isUnlinked()) continue;
--count;
}