diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-12-20 10:44:50 -0500 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-12-20 10:51:58 -0500 |
commit | bac58abec38f78d3f26e8fa638b02c2709137032 (patch) | |
tree | 8afd9dae1f1b3d5bc0bbe757dd57c7b222d399aa /gtk/gtkmodelmenuitem.c | |
parent | 8f5e8b2d0b42338afed20797d4c2eadc3fa5b30e (diff) | |
download | gtk+-bac58abec38f78d3f26e8fa638b02c2709137032.tar.gz |
gtkmodelmenuitem: don't crash on missing action
Diffstat (limited to 'gtk/gtkmodelmenuitem.c')
-rw-r--r-- | gtk/gtkmodelmenuitem.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gtk/gtkmodelmenuitem.c b/gtk/gtkmodelmenuitem.c index ed49dafda4..eb7b8f3596 100644 --- a/gtk/gtkmodelmenuitem.c +++ b/gtk/gtkmodelmenuitem.c @@ -238,14 +238,15 @@ gtk_model_menu_item_setup (GtkModelMenuItem *item, g_action_observable_register_observer (actions, item->action_name, G_ACTION_OBSERVER (item)); if (g_action_group_query_action (G_ACTION_GROUP (actions), item->action_name, &enabled, &type, NULL, NULL, &state)) - gtk_model_menu_item_action_added (G_ACTION_OBSERVER (item), actions, item->action_name, type, enabled, state); + { + gtk_model_menu_item_action_added (G_ACTION_OBSERVER (item), actions, item->action_name, type, enabled, state); + if (state != NULL) + g_variant_unref (state); + } else gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE); - if (state != NULL) - g_variant_unref (state); - path = _gtk_accel_path_for_action (item->action_name, item->target); gtk_menu_item_set_accel_path (GTK_MENU_ITEM (item), path); g_free (path); |