forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
c3c06e60dc
commit
96ccb25f97
@ -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] == '_')
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user