From b39e4a3138a33613ea82e08cf1da1f5007f6efd3 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 28 Feb 2022 22:52:51 +0100 Subject: [PATCH] Do not call CloseNotification for activatable services MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the notification daemon is an activatable GApplication service (e.g. on Mate), then the notification daemon may terminate a short time after the notification has vanished (usually 15s). In that case the notification daemon may reuse notification IDs, which is incompatible with our notification clearing. Also the service may not be running at all, when we call the CloseNotification endpoint. To fix this, we simply disable the entire notification history clearing functionality on such desktops by proactively clearing all notification references from our internal notification manager. Signed-off-by: Magnus Groß --- .../platform/linux/notifications_manager_linux.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index c98634227..1f4cfe06c 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -74,6 +74,9 @@ std::unique_ptr CreateServiceWatcher() { const Glib::ustring &oldOwner, const Glib::ustring &newOwner) { if (activatable && newOwner.empty()) { + crl::on_main([] { + Core::App().notifications().clearAll(); + }); return; } @@ -665,7 +668,9 @@ void NotificationData::close() { _notificationId, }), {}, - std::string(kService)); + std::string(kService), + -1, + Gio::DBus::CALL_FLAGS_NO_AUTO_START); _manager->clearNotification(_id); }