[libadwaita/libadwaita-1-0] Fix AdwToast's use of GVariant
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/libadwaita-1-0] Fix AdwToast's use of GVariant
- Date: Sun, 6 Mar 2022 18:12:56 +0000 (UTC)
commit a295f3dde08a02696d0c1db3ca03f78cc05c98bf
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Mar 3 18:55:32 2022 +0000
Fix AdwToast's use of GVariant
The adw_toast_set_action_target_value() function only
acquires a reference on the GVariant, but we use it
internally with variants directly returned by a
g_variant_new constructor, which returns a floating
reference that must be sunk.
Functions that take a GVariant should always call
g_variant_ref_sink(), unless they are merely holding
a reference and they are documented as requiring a
non-floating GVariant.
(cherry picked from commit df0f65341cd37fdf38123da875564511d4e89feb)
src/adw-toast.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/adw-toast.c b/src/adw-toast.c
index f72f74d4..9fc094aa 100644
--- a/src/adw-toast.c
+++ b/src/adw-toast.c
@@ -590,6 +590,9 @@ adw_toast_get_action_target_value (AdwToast *self)
*
* Sets the parameter for action invocations.
*
+ * If the @action_target variant has a floating reference this function
+ * will sink it.
+ *
* Since: 1.0
*/
void
@@ -606,7 +609,8 @@ adw_toast_set_action_target_value (AdwToast *self,
return;
g_clear_pointer (&self->action_target, g_variant_unref);
- self->action_target = g_variant_ref (action_target);
+ if (action_target != NULL)
+ self->action_target = g_variant_ref_sink (action_target);
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_ACTION_TARGET]);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]