[anjuta] git: fix active_branch_iter not behing null though filled with null values.
- From: James Liggett <jrliggett src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] git: fix active_branch_iter not behing null though filled with null values.
- Date: Tue, 20 Dec 2011 08:48:33 +0000 (UTC)
commit 6a7b348dab8d07d5620d3b3ff09881295970aca5
Author: Alban Browaeys <prahal yahoo com>
Date: Tue Dec 20 00:00:02 2011 +0100
git: fix active_branch_iter not behing null though filled with null values.
Instanciating the object does fill the active_branch_iter private member
with null values while holding an invalid valid pointer to feed the model
for the combobox. This raise a critical error in gtk otherwise (as it expect
either null or valid filled iter).
Note that this only happens on a project not yet migrated to git while
git plugin is enabled.
Fix (anjuta:24950): Gtk-CRITICAL **: gtk_list_store_get_path: assertion
`iter->stamp == priv->stamp' failed
on anjuta load of the git plugin.
Fix implemented via a gtk tree row reference to get the handy valid method.
Not critical as GtkTreeIter is persistent in GtkListStore though testing
an iter for validity can only be done by accessing its pointers which is
noted as "don't do" in the reference.
The row reference is freed when the pane finalize and before being
updated.
plugins/git/git-log-pane.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/plugins/git/git-log-pane.c b/plugins/git/git-log-pane.c
index f989704..3ff4336 100644
--- a/plugins/git/git-log-pane.c
+++ b/plugins/git/git-log-pane.c
@@ -82,7 +82,7 @@ struct _GitLogPanePriv
GHashTable *branches_table;
gchar *selected_branch;
gboolean viewing_active_branch;
- GtkTreeIter active_branch_iter;
+ GtkTreeRowReference *active_branch_ref;
/* Loading spinner data */
guint current_spin_count;
@@ -142,8 +142,13 @@ on_branch_list_command_finished (AnjutaCommand *command,
}
else
{
- gtk_combo_box_set_active_iter (branch_combo,
- &(self->priv->active_branch_iter));
+ if (gtk_tree_row_reference_valid (self->priv->active_branch_ref))
+ {
+ GtkTreePath *path = gtk_tree_row_reference_get_path (self->priv->active_branch_ref);
+ gtk_tree_model_get_iter (log_branch_combo_model, iter, path);
+ gtk_combo_box_set_active_iter (branch_combo, iter);
+ gtk_tree_path_free (path);
+ }
}
}
@@ -173,12 +178,16 @@ on_branch_list_command_data_arrived (AnjutaCommand *command,
if (git_branch_is_active (branch))
{
+ GtkTreePath *path;
gtk_list_store_set (log_branch_combo_model, &iter,
BRANCH_COL_ACTIVE, TRUE,
BRANCH_COL_ACTIVE_ICON, GTK_STOCK_APPLY,
-1);
- self->priv->active_branch_iter = iter;
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (log_branch_combo_model), &iter);
+ gtk_tree_row_reference_free (self->priv->active_branch_ref);
+ self->priv->active_branch_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (log_branch_combo_model), path);
+ gtk_tree_path_free (path);
}
else
{
@@ -983,6 +992,7 @@ git_log_pane_finalize (GObject *object)
self = GIT_LOG_PANE (object);
+ gtk_tree_row_reference_free (self->priv->active_branch_ref);
g_object_unref (self->priv->builder);
g_free (self->priv->path);
g_hash_table_destroy (self->priv->branches_table);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]