[gnome-control-center] region: Make the code more robust
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] region: Make the code more robust
- Date: Fri, 20 Jul 2012 01:38:17 +0000 (UTC)
commit 0af48c80a95f9ca6ceca0b1b65e0a17b96fcb4f3
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jul 19 21:34:18 2012 -0400
region: Make the code more robust
update_ibus_active_sources may very well be called with
an empty treeview. The code that iterates over the model
was assuming that there is at least one item. Fix that
by checking the return value of gtk_tree_model_get_iter_first().
panels/region/gnome-region-panel-input.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/panels/region/gnome-region-panel-input.c b/panels/region/gnome-region-panel-input.c
index 9630bec..a8ff912 100644
--- a/panels/region/gnome-region-panel-input.c
+++ b/panels/region/gnome-region-panel-input.c
@@ -126,12 +126,13 @@ update_ibus_active_sources (GtkBuilder *builder)
GtkTreeModel *model;
GtkTreeIter iter;
gchar *type, *id;
+ gboolean ret;
tv = GTK_TREE_VIEW (WID ("active_input_sources"));
model = gtk_tree_view_get_model (tv);
- gtk_tree_model_get_iter_first (model, &iter);
- do
+ ret = gtk_tree_model_get_iter_first (model, &iter);
+ while (ret)
{
gtk_tree_model_get (model, &iter,
TYPE_COLUMN, &type,
@@ -157,8 +158,9 @@ update_ibus_active_sources (GtkBuilder *builder)
g_free (type);
g_free (id);
+
+ ret = gtk_tree_model_iter_next (model, &iter);
}
- while (gtk_tree_model_iter_next (model, &iter));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]