[evolution/gnome-3-2] Crash on personal certificate removal
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-2] Crash on personal certificate removal
- Date: Wed, 9 Nov 2011 14:10:50 +0000 (UTC)
commit 6ce6b1e9d5b887d12d06957e8204cf8b1b218f02
Author: Milan Crha <mcrha redhat com>
Date: Wed Nov 9 15:10:09 2011 +0100
Crash on personal certificate removal
smime/gui/certificate-manager.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c
index 5e23e1d..0a69d6b 100644
--- a/smime/gui/certificate-manager.c
+++ b/smime/gui/certificate-manager.c
@@ -127,7 +127,6 @@ static const gchar* authoritycerts_mime_types[] = { "application/x-x509-ca-cert
typedef struct {
GtkTreeView *treeview;
- GtkTreeStore *treemodel;
GtkTreeModel *streemodel;
GHashTable *root_hash;
GtkMenu *popup_menu;
@@ -644,10 +643,17 @@ delete_cert (GtkWidget *button,
-1);
if (cert && e_cert_db_delete_cert (e_cert_db_peek (), cert)) {
- GtkTreeIter child_iter;
+ GtkTreeIter child_iter, parent_iter;
+ gboolean has_parent;
+ GtkTreeStore *store = GTK_TREE_STORE (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (cp->streemodel)));
gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (cp->streemodel), &child_iter, &iter);
- gtk_tree_store_remove (cp->treemodel, &child_iter);
+ has_parent = gtk_tree_model_iter_parent (GTK_TREE_MODEL (store), &parent_iter, &child_iter);
+ gtk_tree_store_remove (store, &child_iter);
+
+ /* Remove parent if it became empty */
+ if (has_parent && gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), &parent_iter) == 0)
+ gtk_tree_store_remove (store, &parent_iter);
/* we need two unrefs here, one to unref the
* gtk_tree_model_get above, and one to unref
@@ -862,13 +868,10 @@ cert_page_free (CertPage *cp)
return;
/* Free all certificates in treeviews */
- if (cp->treemodel) {
- gtk_tree_model_foreach (GTK_TREE_MODEL (cp->treemodel),
- (GtkTreeModelForeachFunc) free_cert, cp);
- }
-
/* Free streemodel */
if (cp->streemodel) {
+ gtk_tree_model_foreach (cp->streemodel, (GtkTreeModelForeachFunc) free_cert, cp);
+
g_object_unref (cp->streemodel);
cp->streemodel = NULL;
}
@@ -978,7 +981,6 @@ e_cert_manager_config_init (ECertManagerConfig *ecmc)
priv->yourcerts_page = cp;
cp->treeview = GTK_TREE_VIEW (e_builder_get_widget (priv->builder, "yourcerts-treeview"));
cp->streemodel = NULL;
- cp->treemodel = NULL;
cp->view_button = e_builder_get_widget (priv->builder, "your-view-button");
cp->backup_button = e_builder_get_widget (priv->builder, "your-backup-button");
cp->backup_all_button = e_builder_get_widget (priv->builder, "your-backup-all-button");
@@ -996,7 +998,6 @@ e_cert_manager_config_init (ECertManagerConfig *ecmc)
priv->contactcerts_page = cp;
cp->treeview = GTK_TREE_VIEW (e_builder_get_widget (priv->builder, "contactcerts-treeview"));
cp->streemodel = NULL;
- cp->treemodel = NULL;
cp->view_button = e_builder_get_widget (priv->builder, "contact-view-button");
cp->backup_button = NULL;
cp->backup_all_button = NULL;
@@ -1014,7 +1015,6 @@ e_cert_manager_config_init (ECertManagerConfig *ecmc)
priv->authoritycerts_page = cp;
cp->treeview = GTK_TREE_VIEW (e_builder_get_widget (priv->builder, "authoritycerts-treeview"));
cp->streemodel = NULL;
- cp->treemodel = NULL;
cp->view_button = e_builder_get_widget (priv->builder, "authority-view-button");
cp->backup_button = NULL;
cp->backup_all_button = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]