From 96ccb25f97ab2fd2ec08d11dfe5d281764a732f2 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 26 Mar 2020 17:11:25 +0000 Subject: Return a full reference when parsing triggers We're not returning a full reference for GtkNeverTrigger, but we are returning full references for mnemonic and keyval triggers; this means we're either going to leak mnemonic and keyval triggers if we consider this function a "transfer none" one, or we are going to trigger an assertion failure when finalizing a never trigger, if we consider this function a "transfer full" one. Let's be consistent, and always return a full reference to the caller. --- gtk/gtkshortcuttrigger.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gtk/gtkshortcuttrigger.c') diff --git a/gtk/gtkshortcuttrigger.c b/gtk/gtkshortcuttrigger.c index 50f6958b18..fc36e809e5 100644 --- a/gtk/gtkshortcuttrigger.c +++ b/gtk/gtkshortcuttrigger.c @@ -121,7 +121,8 @@ gtk_shortcut_trigger_trigger (GtkShortcutTrigger *self, * - a string parsed by gtk_accelerator_parse(), for a #GtkKeyvalTrigger * - underscore, followed by a single character, for #GtkMnemonicTrigger * - * Returns: (nullable): a new #GtkShortcutTrigger or %NULL on error + * Returns: (nullable) (transfer full): a new #GtkShortcutTrigger + * or %NULL on error */ GtkShortcutTrigger * gtk_shortcut_trigger_parse_string (const char *string) @@ -132,7 +133,7 @@ gtk_shortcut_trigger_parse_string (const char *string) g_return_val_if_fail (string != NULL, NULL); if (g_str_equal (string, "never")) - return gtk_never_trigger_get (); + return g_object_ref (gtk_never_trigger_get ()); if (string[0] == '_') { -- cgit v1.2.1