diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2020-03-26 17:11:25 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2020-03-27 13:57:19 +0000 |
commit | 96ccb25f97ab2fd2ec08d11dfe5d281764a732f2 (patch) | |
tree | 432f076b0feb933781fc67995861d6576b70cb59 /gtk/gtkshortcuttrigger.c | |
parent | c3c06e60dcc0813fd5007e1e2ab1b99dfafa4298 (diff) | |
download | gtk+-96ccb25f97ab2fd2ec08d11dfe5d281764a732f2.tar.gz |
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.
Diffstat (limited to 'gtk/gtkshortcuttrigger.c')
-rw-r--r-- | gtk/gtkshortcuttrigger.c | 5 |
1 files changed, 3 insertions, 2 deletions
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] == '_') { |