From 4b17fa1a129bfcd08b14803b5917d0c863cf3310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Simon=20Fauteux-Chapleau?= Date: Mon, 29 Jan 2024 11:28:06 -0500 Subject: [PATCH] SystemTray: fix GLib warnings when Jami shuts down Change-Id: I52f4e52bbe5fd535b61c459fb7b6dd22ee8f2053 --- src/app/systemtray.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/systemtray.cpp b/src/app/systemtray.cpp index b3431cea..223b1036 100644 --- a/src/app/systemtray.cpp +++ b/src/app/systemtray.cpp @@ -129,6 +129,14 @@ SystemTray::SystemTray(AppSettingsManager* settingsManager, QObject* parent) SystemTray::~SystemTray() { #ifdef USE_LIBNOTIFY + // Clearing notifications to ensure that g_object_unref is called on every + // NotifyNotification object *before* we call notify_uninit. This isn't strictly + // necessary, but if we don't do it, then the destructor will call g_object_unref + // anyway, and this will happen *after* notify_uninit, which causes GLib to + // generate cryptic warnings when Jami shuts down, e.g.: + // `instance '0x5627a4e236a0' has no handler with id '309'` + pimpl_->notifications.clear(); + notify_uninit(); #endif // USE_LIBNOTIFY hide();