Free Actions in separate method
Also free the memory of the actual Action.
This commit is contained in:
parent
23cae3110d
commit
b571698f52
11
src/dbus.c
11
src/dbus.c
@ -267,13 +267,12 @@ static void on_notify(GDBusConnection *connection,
|
||||
n->category = category;
|
||||
n->dbus_client = g_strdup(sender);
|
||||
n->transient = transient;
|
||||
if (actions->count > 0) {
|
||||
n->actions = actions;
|
||||
} else {
|
||||
n->actions = NULL;
|
||||
g_strfreev(actions->actions);
|
||||
g_free(actions);
|
||||
|
||||
if (actions->count < 1) {
|
||||
actions_free(actions);
|
||||
actions = NULL;
|
||||
}
|
||||
n->actions = actions;
|
||||
|
||||
for (int i = 0; i < ColLast; i++) {
|
||||
n->color_strings[i] = NULL;
|
||||
|
@ -163,6 +163,20 @@ int notification_is_duplicate(const notification *a, const notification *b)
|
||||
&& a->urgency == b->urgency;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the actions element
|
||||
* @a: (nullable): Pointer to #Actions
|
||||
*/
|
||||
void actions_free(Actions *a)
|
||||
{
|
||||
if (!a)
|
||||
return;
|
||||
|
||||
g_strfreev(a->actions);
|
||||
g_free(a->dmenu_str);
|
||||
g_free(a);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free a #RawImage
|
||||
* @i: (nullable): pointer to #RawImage
|
||||
@ -192,11 +206,7 @@ void notification_free(notification *n)
|
||||
g_free(n->text_to_render);
|
||||
g_free(n->urls);
|
||||
|
||||
if (n->actions) {
|
||||
g_strfreev(n->actions->actions);
|
||||
g_free(n->actions->dmenu_str);
|
||||
}
|
||||
|
||||
actions_free(n->actions);
|
||||
rawimage_free(n->raw_icon);
|
||||
|
||||
g_free(n);
|
||||
|
@ -62,6 +62,7 @@ typedef struct _notification {
|
||||
|
||||
notification *notification_create(void);
|
||||
void notification_init(notification *n);
|
||||
void actions_free(Actions *a);
|
||||
void rawimage_free(RawImage *i);
|
||||
void notification_free(notification *n);
|
||||
int notification_cmp(const void *a, const void *b);
|
||||
|
Loading…
x
Reference in New Issue
Block a user