fdo notification: Avoid a double free

We're first getting the notification by its notify_id, but activating
the action afterwards could redraw it, leading to a dangling pointer.
Fix this by simply searching the list of active notifications again
after activating the action.
This commit is contained in:
Timm Bäder 2017-01-19 08:18:59 +01:00
parent d0ffee8feb
commit 1920b550db

View File

@ -178,8 +178,13 @@ notify_signal (GDBusConnection *connection,
}
}
backend->notifications = g_slist_remove (backend->notifications, n);
freedesktop_notification_free (n);
/* Get the notification again in case the action redrew it */
n = g_fdo_notification_backend_find_notification_by_notify_id (backend, id);
if (n != NULL)
{
backend->notifications = g_slist_remove (backend->notifications, n);
freedesktop_notification_free (n);
}
}
/* Converts a GNotificationPriority to an urgency level as defined by