[PATCH] * Fixes a crash when deleting the cache of an account that does not have a CamelStore yet



---
 ChangeLog                                   |    7 +++++++
 libtinymail-camel/tny-camel-store-account.c |   16 ++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2b41fd7..c05edb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-01-27  Sergio Villar Senin  <svillar igalia com>
+
+	* libtinymail-camel/tny-camel-store-account.c
+	(tny_camel_store_account_delete_cache_default): fixes a crash when
+	deleting the cache of an account that does not have a CamelStore
+	yet
+
 2009-01-23  Sergio Villar Senin  <svillar igalia com>
 
 	* libtinymailui-gtk/tny-gtk-folder-list-store.c (deleter): Remove
diff --git a/libtinymail-camel/tny-camel-store-account.c b/libtinymail-camel/tny-camel-store-account.c
index c4b6639..d4f17b5 100644
--- a/libtinymail-camel/tny-camel-store-account.c
+++ b/libtinymail-camel/tny-camel-store-account.c
@@ -183,14 +183,18 @@ static void
 tny_camel_store_account_delete_cache_default (TnyStoreAccount *self)
 {
 	TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self);
-	CamelStore *store = CAMEL_STORE (apriv->service);
-	TnyCamelStoreAccountPriv *priv = TNY_CAMEL_STORE_ACCOUNT_GET_PRIVATE (self);
 
-	priv->deleted = TRUE;
-	priv->cant_reuse_iter = TRUE;
-	apriv->delete_this = camel_store_delete_cache (store);
+	if (apriv->service && CAMEL_IS_STORE (apriv->service)) {
+		CamelStore *store;
+		TnyCamelStoreAccountPriv *priv;
 
-	return;
+		store = CAMEL_STORE (apriv->service);
+		priv = TNY_CAMEL_STORE_ACCOUNT_GET_PRIVATE (self);
+
+		priv->deleted = TRUE;
+		priv->cant_reuse_iter = TRUE;
+		apriv->delete_this = camel_store_delete_cache (store);
+	}
 }
 
 static void
-- 
1.5.2.4


--------------050205040708020503030707--


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]