[evolution-kolab] CamelKolabIMAPXStore: avoid Camel warning (error not set on failure)
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] CamelKolabIMAPXStore: avoid Camel warning (error not set on failure)
- Date: Mon, 16 Jul 2012 12:26:19 +0000 (UTC)
commit 2685c4c054c8bba84842ba2c97ce0f7863496f7a
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Fri Jul 13 15:40:57 2012 +0200
CamelKolabIMAPXStore: avoid Camel warning (error not set on failure)
* if kolab_imapx_store_get_folder_info_sync() has no folder
info to return to the caller (e.g. when no folder matching
the configured to-care-for-type can be found), this is not
an error (so we don't set one), but we need to return an
empty CamelFolderInfo instead of NULL as expected by Camel
* cleaned up that function so we can release the lock just
before returning
src/libekolab/camel-kolab-imapx-store.c | 38 +++++++++++++++++++++---------
1 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/src/libekolab/camel-kolab-imapx-store.c b/src/libekolab/camel-kolab-imapx-store.c
index 33e209c..2ab10bf 100644
--- a/src/libekolab/camel-kolab-imapx-store.c
+++ b/src/libekolab/camel-kolab-imapx-store.c
@@ -597,24 +597,38 @@ kolab_imapx_store_get_folder_info_sync (CamelStore *self,
&tmp_err);
if (tmp_err != NULL)
goto exit;
- if (fi == NULL)
- goto exit;
- k_fi = imapx_store_folder_info_build_restricted (myself,
- fi,
- cancellable,
- &tmp_err);
- exit:
- if (fi != NULL)
+ if (fi != NULL) {
+ k_fi = imapx_store_folder_info_build_restricted (myself,
+ fi,
+ cancellable,
+ &tmp_err);
camel_store_free_folder_info (self, fi);
- g_mutex_unlock (&(priv->kolab_finfo_lock));
+ if (tmp_err != NULL)
+ goto exit;
+ }
- if (tmp_err != NULL) {
- g_propagate_error (err, tmp_err);
- return NULL;
+ if (k_fi == NULL) {
+ /* No folder information - returning NULL would
+ * mean we would have to set an error, but no
+ * folder info (all folders hidden or no type
+ * information available) is not technically an
+ * error here. It can happen, depending on the folder
+ * type we're supposed to care for. Hence, we're
+ * returning an empty (but non-NULL) CamelFolderInfo
+ * in the hopes that the caller will know what to
+ * do about it (i.e., display nothing).
+ */
+ k_fi = camel_folder_info_new ();
}
+ exit:
+ if (tmp_err != NULL)
+ g_propagate_error (err, tmp_err);
+
+ g_mutex_unlock (&(priv->kolab_finfo_lock));
+
return k_fi;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]