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->category = category;
|
||||||
n->dbus_client = g_strdup(sender);
|
n->dbus_client = g_strdup(sender);
|
||||||
n->transient = transient;
|
n->transient = transient;
|
||||||
if (actions->count > 0) {
|
|
||||||
n->actions = actions;
|
if (actions->count < 1) {
|
||||||
} else {
|
actions_free(actions);
|
||||||
n->actions = NULL;
|
actions = NULL;
|
||||||
g_strfreev(actions->actions);
|
|
||||||
g_free(actions);
|
|
||||||
}
|
}
|
||||||
|
n->actions = actions;
|
||||||
|
|
||||||
for (int i = 0; i < ColLast; i++) {
|
for (int i = 0; i < ColLast; i++) {
|
||||||
n->color_strings[i] = NULL;
|
n->color_strings[i] = NULL;
|
||||||
|
@ -163,6 +163,20 @@ int notification_is_duplicate(const notification *a, const notification *b)
|
|||||||
&& a->urgency == b->urgency;
|
&& 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
|
* Free a #RawImage
|
||||||
* @i: (nullable): pointer to #RawImage
|
* @i: (nullable): pointer to #RawImage
|
||||||
@ -192,11 +206,7 @@ void notification_free(notification *n)
|
|||||||
g_free(n->text_to_render);
|
g_free(n->text_to_render);
|
||||||
g_free(n->urls);
|
g_free(n->urls);
|
||||||
|
|
||||||
if (n->actions) {
|
actions_free(n->actions);
|
||||||
g_strfreev(n->actions->actions);
|
|
||||||
g_free(n->actions->dmenu_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
rawimage_free(n->raw_icon);
|
rawimage_free(n->raw_icon);
|
||||||
|
|
||||||
g_free(n);
|
g_free(n);
|
||||||
|
@ -62,6 +62,7 @@ typedef struct _notification {
|
|||||||
|
|
||||||
notification *notification_create(void);
|
notification *notification_create(void);
|
||||||
void notification_init(notification *n);
|
void notification_init(notification *n);
|
||||||
|
void actions_free(Actions *a);
|
||||||
void rawimage_free(RawImage *i);
|
void rawimage_free(RawImage *i);
|
||||||
void notification_free(notification *n);
|
void notification_free(notification *n);
|
||||||
int notification_cmp(const void *a, const void *b);
|
int notification_cmp(const void *a, const void *b);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user