[gedit] Be more robust when closing the dialog
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Be more robust when closing the dialog
- Date: Mon, 26 Dec 2011 10:45:55 +0000 (UTC)
commit ea574bf12e9e2a6a584e3f0a13df93dd98b15c88
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Dec 26 11:46:28 2011 +0100
Be more robust when closing the dialog
Gtk started to emit cursor-changed when the treeview is destroyed. I am
not sure if it is a Gtk bug or if it is intentional, but we should check
for errors returned by the getter function.
gedit/dialogs/gedit-preferences-dialog.c | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/gedit/dialogs/gedit-preferences-dialog.c b/gedit/dialogs/gedit-preferences-dialog.c
index 881fc11..14651d7 100644
--- a/gedit/dialogs/gedit-preferences-dialog.c
+++ b/gedit/dialogs/gedit-preferences-dialog.c
@@ -482,21 +482,25 @@ style_scheme_changed (GtkWidget *treeview,
GeditPreferencesDialog *dlg)
{
GtkTreePath *path;
- GtkTreeIter iter;
- gchar *id;
gtk_tree_view_get_cursor (GTK_TREE_VIEW (dlg->priv->schemes_treeview), &path, NULL);
- gtk_tree_model_get_iter (GTK_TREE_MODEL (dlg->priv->schemes_treeview_model),
- &iter, path);
- gtk_tree_path_free (path);
- gtk_tree_model_get (GTK_TREE_MODEL (dlg->priv->schemes_treeview_model),
- &iter, ID_COLUMN, &id, -1);
+ if (path != NULL)
+ {
+ GtkTreeIter iter;
+ gchar *id;
- g_settings_set_string (dlg->priv->editor, GEDIT_SETTINGS_SCHEME, id);
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (dlg->priv->schemes_treeview_model),
+ &iter, path);
+ gtk_tree_path_free (path);
+ gtk_tree_model_get (GTK_TREE_MODEL (dlg->priv->schemes_treeview_model),
+ &iter, ID_COLUMN, &id, -1);
- set_buttons_sensisitivity_according_to_scheme (dlg, id);
+ g_settings_set_string (dlg->priv->editor, GEDIT_SETTINGS_SCHEME, id);
- g_free (id);
+ set_buttons_sensisitivity_according_to_scheme (dlg, id);
+
+ g_free (id);
+ }
}
static const gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]