[evolution-data-server] Fix console runtime warnings from vFolder/vStore code on application quit
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Fix console runtime warnings from vFolder/vStore code on application quit
- Date: Thu, 6 Oct 2016 17:37:14 +0000 (UTC)
commit 523a82d44cb16f9b9283923d0b9324156826ece0
Author: Milan Crha <mcrha redhat com>
Date: Thu Oct 6 19:35:58 2016 +0200
Fix console runtime warnings from vFolder/vStore code on application quit
It could happen that search folders of search folders emitted runtime
warnings on console on the application quit, which was caused by
missing checks for such situation.
camel/camel-vee-folder.c | 32 +++++++++++++++++++++++++++++---
camel/camel-vee-store.c | 17 +++++++++++++++--
2 files changed, 44 insertions(+), 5 deletions(-)
---
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 1c9fcc9..5566caa 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -269,6 +269,10 @@ vee_folder_merge_matching (CamelVeeFolder *vfolder,
g_return_if_fail (vsummary != NULL);
data_cache = vee_folder_get_data_cache (vfolder);
+ /* It can be NULL on dispose of the CamelVeeStore */
+ if (!data_cache)
+ return;
+
for (ii = 0; ii < match->len; ii++) {
const gchar *uid = match->pdata[ii];
@@ -385,8 +389,12 @@ vee_folder_subfolder_changed (CamelVeeFolder *vfolder,
}
g_rec_mutex_unlock (&vfolder->priv->subfolder_lock);
- changes = camel_folder_change_info_new ();
data_cache = vee_folder_get_data_cache (vfolder);
+ /* It can be NULL on dispose of the CamelVeeStore */
+ if (!data_cache)
+ return;
+
+ changes = camel_folder_change_info_new ();
v_folder = CAMEL_FOLDER (vfolder);
vsummary = CAMEL_VEE_SUMMARY (v_folder->summary);
@@ -663,8 +671,15 @@ vee_folder_propagate_skipped_changes (CamelVeeFolder *vf)
CamelFolder *v_folder;
CamelVeeDataCache *data_cache;
- changes = camel_folder_change_info_new ();
data_cache = vee_folder_get_data_cache (vf);
+
+ /* It can be NULL on dispose of the CamelVeeStore */
+ if (!data_cache) {
+ g_rec_mutex_unlock (&vf->priv->changed_lock);
+ return;
+ }
+
+ changes = camel_folder_change_info_new ();
v_folder = CAMEL_FOLDER (vf);
vsummary = CAMEL_VEE_SUMMARY (v_folder->summary);
@@ -1079,6 +1094,14 @@ vee_folder_remove_folder (CamelVeeFolder *vfolder,
rud.changes = changes;
rud.is_orig_message_uid = FALSE;
+ /* It can be NULL on dispose of the CamelVeeStore */
+ if (!rud.data_cache) {
+ camel_folder_thaw (v_folder);
+ camel_folder_change_info_free (changes);
+ g_hash_table_destroy (uids);
+ return;
+ }
+
g_hash_table_foreach (uids, vee_folder_remove_unmatched_cb, &rud);
if (vee_folder_is_unmatched (vfolder) &&
@@ -1609,7 +1632,10 @@ camel_vee_folder_remove_vuid (CamelVeeFolder *vfolder,
vsummary = CAMEL_VEE_SUMMARY (CAMEL_FOLDER (vfolder)->summary);
data_cache = vee_folder_get_data_cache (vfolder);
- vee_folder_note_unmatch_uid (vfolder, vsummary, subfolder, data_cache, mi_data, changes);
+
+ /* It can be NULL on dispose of the CamelVeeStore */
+ if (data_cache)
+ vee_folder_note_unmatch_uid (vfolder, vsummary, subfolder, data_cache, mi_data, changes);
}
/**
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index 97511cc..93697ba 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -149,14 +149,26 @@ vee_store_get_property (GObject *object,
}
static void
+vee_store_dispose (GObject *object)
+{
+ CamelVeeStorePrivate *priv;
+
+ priv = CAMEL_VEE_STORE_GET_PRIVATE (object);
+
+ g_clear_object (&priv->vee_data_cache);
+ g_clear_object (&priv->unmatched_folder);
+
+ /* Chain up to parent's method. */
+ G_OBJECT_CLASS (camel_vee_store_parent_class)->dispose (object);
+}
+
+static void
vee_store_finalize (GObject *object)
{
CamelVeeStorePrivate *priv;
priv = CAMEL_VEE_STORE_GET_PRIVATE (object);
- g_object_unref (priv->unmatched_folder);
- g_object_unref (priv->vee_data_cache);
g_hash_table_destroy (priv->subfolder_usage_counts);
g_hash_table_destroy (priv->vuid_usage_counts);
g_mutex_clear (&priv->sf_counts_mutex);
@@ -510,6 +522,7 @@ camel_vee_store_class_init (CamelVeeStoreClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->set_property = vee_store_set_property;
object_class->get_property = vee_store_get_property;
+ object_class->dispose = vee_store_dispose;
object_class->finalize = vee_store_finalize;
object_class->constructed = vee_store_constructed;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]