From ed8148bd076454d1f51adb7158547318195f4e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nelson=20Ben=C3=ADtez=20Le=C3=B3n?= Date: Thu, 6 Apr 2023 18:45:59 -0400 Subject: [PATCH] inspector: fix crash caused by uninitialized GVariant we were not checking the return gboolean of gtk_action_muxer_query_action() which was returning FALSE for the crash case, meaning it didn't set the passed in GVariant, but we were still using it as it was non-null. Fixes #5729 --- gtk/inspector/actions.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c index eeac0a188e..eb979bfd0c 100644 --- a/gtk/inspector/actions.c +++ b/gtk/inspector/actions.c @@ -172,10 +172,9 @@ bind_parameter_cb (GtkSignalListItemFactory *factory, name = action_holder_get_name (ACTION_HOLDER (item)); if (G_IS_ACTION_GROUP (owner)) parameter = (const char *)g_action_group_get_action_parameter_type (G_ACTION_GROUP (owner), name); - else if (GTK_IS_ACTION_MUXER (owner)) - gtk_action_muxer_query_action (GTK_ACTION_MUXER (owner), name, - NULL, (const GVariantType **)¶meter, NULL, NULL, NULL); - else + else if (!GTK_IS_ACTION_MUXER (owner) || + !gtk_action_muxer_query_action (GTK_ACTION_MUXER (owner), name, + NULL, (const GVariantType **)¶meter, NULL, NULL, NULL)) parameter = "(Unknown)"; gtk_label_set_label (GTK_LABEL (label), parameter); @@ -212,10 +211,9 @@ bind_state_cb (GtkSignalListItemFactory *factory, name = action_holder_get_name (ACTION_HOLDER (item)); if (G_IS_ACTION_GROUP (owner)) state = g_action_group_get_action_state (G_ACTION_GROUP (owner), name); - else if (GTK_IS_ACTION_MUXER (owner)) - gtk_action_muxer_query_action (GTK_ACTION_MUXER (owner), name, - NULL, NULL, NULL, NULL, &state); - else + else if (!GTK_IS_ACTION_MUXER (owner) || + !gtk_action_muxer_query_action (GTK_ACTION_MUXER (owner), name, + NULL, NULL, NULL, NULL, &state)) state = NULL; if (state)