This is an automated email from the git hooks/post-receive script. bluesabre pushed a commit to branch master in repository xfce/xfce4-settings.
commit e0f9a220adbd41a24d9e3df9af7e89a0ef97478e Author: Sean Davis <smd.seanda...@gmail.com> Date: Fri Feb 6 21:44:18 2015 -0500 Fix Unchecked return values, potentially revealing missed warnings --- dialogs/keyboard-settings/xfce-keyboard-settings.c | 114 +++++++++++--------- dialogs/mime-settings/xfce-mime-chooser.c | 10 +- xfsettingsd/clipboard-manager.c | 15 ++- xfsettingsd/displays.c | 16 ++- 4 files changed, 91 insertions(+), 64 deletions(-) diff --git a/dialogs/keyboard-settings/xfce-keyboard-settings.c b/dialogs/keyboard-settings/xfce-keyboard-settings.c index 384f17d..e2a93a0 100644 --- a/dialogs/keyboard-settings/xfce-keyboard-settings.c +++ b/dialogs/keyboard-settings/xfce-keyboard-settings.c @@ -1633,12 +1633,14 @@ xfce_keyboard_settings_layouts_combo_changed (GtkComboBox *combo, GtkTreeIter iter; gchar *xfconf_prop_value; - gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter); - model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo)); - gtk_tree_model_get (model, &iter, XKB_LAYOUTS_COMBO_VALUE, &xfconf_prop_value, -1); - xfconf_channel_set_string (settings->priv->keyboard_layout_channel, - xfconf_prop_name, xfconf_prop_value); - g_free (xfconf_prop_value); + if (G_LIKELY(gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter))) + { + model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo)); + gtk_tree_model_get (model, &iter, XKB_LAYOUTS_COMBO_VALUE, &xfconf_prop_value, -1); + xfconf_channel_set_string (settings->priv->keyboard_layout_channel, + xfconf_prop_name, xfconf_prop_value); + g_free (xfconf_prop_value); + } } @@ -1718,27 +1720,29 @@ xfce_keyboard_settings_edit_layout_button_cb (GtkWidget *widget, model = gtk_tree_view_get_model (GTK_TREE_VIEW (view)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); - gtk_tree_selection_get_selected (selection, &model, &iter); - gtk_tree_model_get (model, &iter, - XKB_TREE_LAYOUTS, ¤t_layout, - XKB_TREE_VARIANTS, ¤t_variant, - -1); - - layout_selection = - xfce_keyboard_settings_layout_selection (settings, current_layout, current_variant); - if (layout_selection) - { - gtk_list_store_set (GTK_LIST_STORE (model), &iter, - XKB_TREE_LAYOUTS, layout_selection[0], - XKB_TREE_LAYOUTS_NAMES, layout_selection[1], - XKB_TREE_VARIANTS, layout_selection[2], - XKB_TREE_VARIANTS_NAMES, layout_selection[3], - -1); - xfce_keyboard_settings_set_layout (settings); - g_strfreev (layout_selection); - } - g_free (current_layout); - g_free (current_variant); + if (G_LIKELY (gtk_tree_selection_get_selected (selection, &model, &iter))) + { + gtk_tree_model_get (model, &iter, + XKB_TREE_LAYOUTS, ¤t_layout, + XKB_TREE_VARIANTS, ¤t_variant, + -1); + + layout_selection = + xfce_keyboard_settings_layout_selection (settings, current_layout, current_variant); + if (layout_selection) + { + gtk_list_store_set (GTK_LIST_STORE (model), &iter, + XKB_TREE_LAYOUTS, layout_selection[0], + XKB_TREE_LAYOUTS_NAMES, layout_selection[1], + XKB_TREE_VARIANTS, layout_selection[2], + XKB_TREE_VARIANTS_NAMES, layout_selection[3], + -1); + xfce_keyboard_settings_set_layout (settings); + g_strfreev (layout_selection); + } + g_free (current_layout); + g_free (current_variant); + } } @@ -2079,34 +2083,38 @@ xfce_keyboard_settings_layout_selection (XfceKeyboardSettings *settings, result = gtk_dialog_run (GTK_DIALOG (keyboard_layout_selection_dialog)); if (result == GTK_RESPONSE_OK) { - gtk_tree_selection_get_selected (selection, &model, &iter); - gtk_tree_model_get (model, &iter, XKB_AVAIL_LAYOUTS_TREE_ID, &layout, - XKB_AVAIL_LAYOUTS_TREE_DESCRIPTION, &layout_desc, -1); - - path = gtk_tree_model_get_path (model, &iter); - if (gtk_tree_path_get_depth (path) == 1) - { - variant = g_strdup (""); - variant_desc = g_strdup (""); - } - else - { - variant = layout; - variant_desc = layout_desc; - gtk_tree_path_up (path); - gtk_tree_model_get_iter (model, &iter, path); - gtk_tree_model_get (model, &iter, XKB_AVAIL_LAYOUTS_TREE_ID, &layout, - XKB_AVAIL_LAYOUTS_TREE_DESCRIPTION, &layout_desc, -1); - } + if (G_LIKELY (gtk_tree_selection_get_selected (selection, &model, &iter))) + { + gtk_tree_model_get (model, &iter, XKB_AVAIL_LAYOUTS_TREE_ID, &layout, + XKB_AVAIL_LAYOUTS_TREE_DESCRIPTION, &layout_desc, -1); + + path = gtk_tree_model_get_path (model, &iter); + if (gtk_tree_path_get_depth (path) == 1) + { + variant = g_strdup (""); + variant_desc = g_strdup (""); + } + else + { + variant = layout; + variant_desc = layout_desc; + gtk_tree_path_up (path); + if (G_LIKELY (gtk_tree_model_get_iter (model, &iter, path))) + { + gtk_tree_model_get (model, &iter, XKB_AVAIL_LAYOUTS_TREE_ID, &layout, + XKB_AVAIL_LAYOUTS_TREE_DESCRIPTION, &layout_desc, -1); + } + } - val_layout = g_new0 (typeof (gchar*), 5); - val_layout[0] = layout; - val_layout[1] = layout_desc; - val_layout[2] = variant; - val_layout[3] = variant_desc; - val_layout[4] = NULL; + val_layout = g_new0 (typeof (gchar*), 5); + val_layout[0] = layout; + val_layout[1] = layout_desc; + val_layout[2] = variant; + val_layout[3] = variant_desc; + val_layout[4] = NULL; - gtk_tree_path_free (path); + gtk_tree_path_free (path); + } } gtk_widget_hide (GTK_WIDGET (keyboard_layout_selection_dialog)); diff --git a/dialogs/mime-settings/xfce-mime-chooser.c b/dialogs/mime-settings/xfce-mime-chooser.c index 427b9fe..323a275 100644 --- a/dialogs/mime-settings/xfce-mime-chooser.c +++ b/dialogs/mime-settings/xfce-mime-chooser.c @@ -290,10 +290,12 @@ xfce_mime_chooser_row_can_select (GtkTreeSelection *selection, if (G_UNLIKELY (!path_currently_selected)) { /* check if there's an application for the path */ - gtk_tree_model_get_iter (model, &iter, path); - gtk_tree_model_get_value (model, &iter, CHOOSER_COLUMN_APP_INFO, &value); - permitted = (g_value_get_object (&value) != NULL); - g_value_unset (&value); + if (G_LIKELY (gtk_tree_model_get_iter (model, &iter, path))) + { + gtk_tree_model_get_value (model, &iter, CHOOSER_COLUMN_APP_INFO, &value); + permitted = (g_value_get_object (&value) != NULL); + g_value_unset (&value); + } } return permitted; diff --git a/xfsettingsd/clipboard-manager.c b/xfsettingsd/clipboard-manager.c index b142915..16246ef 100644 --- a/xfsettingsd/clipboard-manager.c +++ b/xfsettingsd/clipboard-manager.c @@ -189,7 +189,10 @@ send_selection_notify (GsdClipboardManager *manager, (XEvent *)¬ify); XSync (manager->priv->display, False); - gdk_error_trap_pop (); + if (gdk_error_trap_pop () != 0) + { + g_critical ("Failed to notify clipboard selection"); + } } static void @@ -216,7 +219,10 @@ finish_selection_request (GsdClipboardManager *manager, False, NoEventMask, (XEvent *) ¬ify); XSync (manager->priv->display, False); - gdk_error_trap_pop (); + if (gdk_error_trap_pop () != 0) + { + g_critical ("Failed to send selection request"); + } } static int @@ -599,7 +605,10 @@ convert_clipboard_target (IncrConversion *rdata, XSync (manager->priv->display, False); - gdk_error_trap_pop (); + if (gdk_error_trap_pop () != 0) + { + g_critical ("Failed to transfer clipboard contents"); + } } } } diff --git a/xfsettingsd/displays.c b/xfsettingsd/displays.c index 6d5e8db..095e323 100644 --- a/xfsettingsd/displays.c +++ b/xfsettingsd/displays.c @@ -351,7 +351,10 @@ xfce_displays_helper_finalize (GObject *object) gdk_error_trap_push (); XRRFreeScreenResources (helper->resources); gdk_flush (); - gdk_error_trap_pop (); + if (gdk_error_trap_pop () != 0) + { + g_critical ("Failed to free screen resources"); + } helper->resources = NULL; } @@ -871,8 +874,10 @@ xfce_displays_helper_free_output (XfceRROutput *output) gdk_error_trap_push (); XRRFreeOutputInfo (output->info); gdk_flush (); - gdk_error_trap_pop (); - + if (gdk_error_trap_pop () != 0) + { + g_critical ("Failed to free output info"); + } g_free (output); } @@ -1215,7 +1220,10 @@ xfce_displays_helper_apply_all (XfceDisplaysHelper *helper) /* release the grab, changes are done */ gdk_x11_display_ungrab (helper->display); gdk_flush (); - gdk_error_trap_pop (); + if (gdk_error_trap_pop () != 0) + { + g_critical ("Failed to apply display settings"); + } } -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits