gfdonotificationbackend: Improve internal docs around floating GVariants

The code is correct, but from a quick read-through it wasn’t entirely
clear to me how it handled floating `GVariant`s in object state or the
`parameter` argument.

Add an assertion and some comments to hopefully clarify things a little.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2022-11-15 17:46:42 +00:00
parent d470e7227a
commit 716189c4c7

View File

@ -63,8 +63,8 @@ typedef struct
GFdoNotificationBackend *backend;
gchar *id;
guint32 notify_id;
gchar *default_action;
GVariant *default_action_target;
gchar *default_action; /* (nullable) (owned) */
GVariant *default_action_target; /* (nullable) (owned), not floating */
} FreedesktopNotification;
static void
@ -138,6 +138,9 @@ activate_action (GFdoNotificationBackend *backend,
{
GNotificationBackend *g_backend = G_NOTIFICATION_BACKEND (backend);
/* Callers should not provide a floating variant here */
g_assert (parameter == NULL || !g_variant_is_floating (parameter));
if (name)
{
if (g_str_has_prefix (name, "app."))