From 1ec9137fd7fa44516d3b1bb700464407c89e5003 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Oct 2018 08:29:31 +0300 Subject: [PATCH] Clear locations data on logout. Fixes a crash. Also clear user notification center delegate on macOS. --- Telegram/SourceFiles/app.cpp | 4 +++- .../SourceFiles/platform/mac/notifications_manager_mac.mm | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index e794571f3..984f17d2b 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -1255,7 +1255,6 @@ namespace App { void historyClearMsgs() { ::dependentItems.clear(); - const auto oldData = base::take(msgsData); const auto oldChannelData = base::take(channelMsgsData); for (const auto item : oldData) { @@ -1266,6 +1265,9 @@ namespace App { delete item; } } + for (const auto data : base::take(::locationsData)) { + delete data; + } clearMousedItems(); } diff --git a/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm b/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm index 49836a697..d385425a8 100644 --- a/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm +++ b/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm @@ -317,6 +317,8 @@ Manager::Private::~Private() { putClearTask(ClearFinish()); _clearingThread.join(); } + NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter]; + [center setDelegate:nil]; [_delegate release]; }