diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-11-17 06:49:52 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-11-17 08:24:02 +0800 |
commit | c134c41bcdd826228f697c11ab4b375b65bd97fa (patch) | |
tree | 025bdfd6f3627aa978f672c12620dd676ee6859b /mail/em-folder-tree-model.c | |
parent | 19708882803f5dbd763b202da297c8cbf8f6b7f7 (diff) | |
download | gsoc2013-evolution-c134c41bcdd826228f697c11ab4b375b65bd97fa.tar gsoc2013-evolution-c134c41bcdd826228f697c11ab4b375b65bd97fa.tar.gz gsoc2013-evolution-c134c41bcdd826228f697c11ab4b375b65bd97fa.tar.bz2 gsoc2013-evolution-c134c41bcdd826228f697c11ab4b375b65bd97fa.tar.lz gsoc2013-evolution-c134c41bcdd826228f697c11ab4b375b65bd97fa.tar.xz gsoc2013-evolution-c134c41bcdd826228f697c11ab4b375b65bd97fa.tar.zst gsoc2013-evolution-c134c41bcdd826228f697c11ab4b375b65bd97fa.zip |
EMFolderTreeModel: Declare the CamelStore column as an object type.
Declaring the CamelStore column as a raw pointer type dates back to
before Camel was GObject-based. The problem is the CamelStore could
be finalized while the tree model still has a pointer to it, leaving
behind dangling pointers in the tree model which could cause a crash.
Declaring the column type in the column enum turned out to be a good
idea, as it makes code that needs updated easy to find. This renames
the enum value from COL_POINTER_CAMEL_STORE to COL_OBJECT_CAMEL_STORE.
Diffstat (limited to 'mail/em-folder-tree-model.c')
-rw-r--r-- | mail/em-folder-tree-model.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 69c80959b1..4859f970be 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -135,7 +135,7 @@ folder_tree_model_sort (GtkTreeModel *model, gtk_tree_model_get ( model, a, COL_BOOL_IS_STORE, &a_is_store, - COL_POINTER_CAMEL_STORE, &service_a, + COL_OBJECT_CAMEL_STORE, &service_a, COL_STRING_DISPLAY_NAME, &aname, COL_UINT_FLAGS, &flags_a, -1); @@ -143,7 +143,7 @@ folder_tree_model_sort (GtkTreeModel *model, gtk_tree_model_get ( model, b, COL_BOOL_IS_STORE, &b_is_store, - COL_POINTER_CAMEL_STORE, &service_b, + COL_OBJECT_CAMEL_STORE, &service_b, COL_STRING_DISPLAY_NAME, &bname, COL_UINT_FLAGS, &flags_b, -1); @@ -185,6 +185,9 @@ folder_tree_model_sort (GtkTreeModel *model, g_free (aname); g_free (bname); + g_clear_object (&service_a); + g_clear_object (&service_b); + return rv; } @@ -330,18 +333,18 @@ static void folder_tree_model_constructed (GObject *object) { GType col_types[] = { - G_TYPE_STRING, /* display name */ - G_TYPE_POINTER, /* store object */ - G_TYPE_STRING, /* full name */ - G_TYPE_STRING, /* icon name */ - G_TYPE_UINT, /* unread count */ - G_TYPE_UINT, /* flags */ - G_TYPE_BOOLEAN, /* is a store node */ - G_TYPE_BOOLEAN, /* is a folder node */ - G_TYPE_BOOLEAN, /* has not-yet-loaded subfolders */ - G_TYPE_UINT, /* last known unread count */ - G_TYPE_BOOLEAN, /* folder is a draft folder */ - G_TYPE_UINT /* user's sortorder */ + G_TYPE_STRING, /* display name */ + CAMEL_TYPE_STORE, /* CamelStore */ + G_TYPE_STRING, /* full name */ + G_TYPE_STRING, /* icon name */ + G_TYPE_UINT, /* unread count */ + G_TYPE_UINT, /* flags */ + G_TYPE_BOOLEAN, /* is a store node */ + G_TYPE_BOOLEAN, /* is a folder node */ + G_TYPE_BOOLEAN, /* has not-yet-loaded subfolders */ + G_TYPE_UINT, /* last known unread count */ + G_TYPE_BOOLEAN, /* folder is a draft folder */ + G_TYPE_UINT /* user's sortorder */ }; gtk_tree_store_set_column_types ( @@ -821,7 +824,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, gtk_tree_store_set ( tree_store, iter, COL_STRING_DISPLAY_NAME, display_name, - COL_POINTER_CAMEL_STORE, si->store, + COL_OBJECT_CAMEL_STORE, si->store, COL_STRING_FULL_NAME, fi->full_name, COL_STRING_ICON_NAME, icon_name, COL_UINT_FLAGS, flags, @@ -853,7 +856,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, gtk_tree_store_set ( tree_store, &sub, COL_STRING_DISPLAY_NAME, _("Loading..."), - COL_POINTER_CAMEL_STORE, si->store, + COL_OBJECT_CAMEL_STORE, si->store, COL_STRING_FULL_NAME, NULL, COL_STRING_ICON_NAME, NULL, COL_BOOL_LOAD_SUBDIRS, FALSE, @@ -1121,7 +1124,7 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, gtk_tree_store_set ( tree_store, &iter, COL_STRING_DISPLAY_NAME, display_name, - COL_POINTER_CAMEL_STORE, store, + COL_OBJECT_CAMEL_STORE, store, COL_STRING_FULL_NAME, NULL, COL_BOOL_LOAD_SUBDIRS, TRUE, COL_BOOL_IS_STORE, TRUE, @@ -1148,7 +1151,7 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, gtk_tree_store_set ( tree_store, &iter, COL_STRING_DISPLAY_NAME, _("Loading..."), - COL_POINTER_CAMEL_STORE, store, + COL_OBJECT_CAMEL_STORE, store, COL_STRING_FULL_NAME, NULL, COL_BOOL_LOAD_SUBDIRS, FALSE, COL_BOOL_IS_STORE, FALSE, |