Some more memory improvements

* Less leaks
* Less allocations

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel
2025-03-07 22:31:58 +01:00
parent 9fc0326428
commit 95c2199ca2
10 changed files with 63 additions and 21 deletions

View File

@@ -56,6 +56,9 @@
#include "xmpp/muc.h"
static GTimer* remind_timer;
#ifdef HAVE_LIBNOTIFY
static NotifyNotification* notification;
#endif
void
notifier_initialise(void)
@@ -67,6 +70,8 @@ void
notifier_uninit(void)
{
#ifdef HAVE_LIBNOTIFY
g_object_unref(G_OBJECT(notification));
notification = NULL;
if (notify_is_initted()) {
notify_uninit();
}
@@ -208,7 +213,8 @@ notify(const char* const message, int timeout, const char* const category)
notify_init("Profanity");
if (notify_is_initted()) {
NotifyNotification* notification;
if (notification)
g_object_unref(G_OBJECT(notification));
notification = notify_notification_new("Profanity", message, NULL);
notify_notification_set_timeout(notification, timeout);
notify_notification_set_category(notification, category);