[gtk/trigger-parser: 1/4] Return a full reference when parsing triggers
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/trigger-parser: 1/4] Return a full reference when parsing triggers
- Date: Thu, 26 Mar 2020 17:17:17 +0000 (UTC)
commit cfae5109fdf555ff2038feb74f361c1461db84e2
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Mar 26 17:11:25 2020 +0000
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(-)
---
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] == '_')
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]