TnyMergeFolder should not return "" for ID.



This fixes a DBC contract problem. Permission to commit?
I do worry that the ID should also be unique, but this is better than
before, at least.

There's also an unrelated documentation improvement here. I was too lazy
to remove it from the patch.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com
Index: libtinymail-camel/tny-camel-account.c
===================================================================
--- libtinymail-camel/tny-camel-account.c	(revision 2483)
+++ libtinymail-camel/tny-camel-account.c	(working copy)
@@ -1165,7 +1165,11 @@
  * @online: whether or not the account is online
  * @err: a #GError instance or NULL
  *
- * Set the connectivity status of an account
+ * Set the connectivity status of an account.
+ * Setting this to FALSE means that the account will not attempt to use the network, 
+ * and will use only the cache.
+ * Setting this to TRUE means that the account may use the network to provide up-to-date 
+ * information.
  *
  **/
 void 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2483)
+++ ChangeLog	(working copy)
@@ -1,3 +1,14 @@
+2007-07-23  Murray Cumming  <murrayc murrayc com>
+
+	* libtinymail-camel/tny-camel-account.c: Improved the 
+	documentation for tny_camel_account_set_online().
+
+	* libtinymail/tny-merge-folder.c: (tny_merge_folder_get_id),
+	(tny_merge_folder_instance_init): Use 
+	unknown_mergefolder instead of an empty string for the default ID, 
+	because an empty string is not allowed by the get_func_id() DBC 
+	contract, causing a crash at runtime when DBC is enabled in the build.
+
 2007-07-23  Jose Dapena Paz  <jdapena igalia com>
 
 	* libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c:
Index: libtinymail/tny-merge-folder.c
===================================================================
--- libtinymail/tny-merge-folder.c	(revision 2483)
+++ libtinymail/tny-merge-folder.c	(working copy)
@@ -509,6 +509,11 @@
 
 	}
 
+	/* The get_id_func() DBC contract does not allow this to be NULL or "": */
+	if ( (priv->id == NULL) || (strlen (priv->id) == 0)) {
+		priv->id = g_strdup ("unknown_mergefolder");	
+	}
+	
 	return priv->id;
 }
 
@@ -1232,7 +1237,9 @@
 	TnyMergeFolder *self = (TnyMergeFolder *) instance;
 	TnyMergeFolderPriv *priv = TNY_MERGE_FOLDER_GET_PRIVATE (self);
 
-	priv->id = g_strdup  ("");
+	/* The get_id_func() DBC contract does not allow this to be NULL or "": */
+	priv->id = g_strdup ("unknown_mergefolder");
+	
 	priv->mothers = tny_simple_list_new ();
 	priv->lock = g_new0 (GStaticRecMutex, 1);
 	g_static_rec_mutex_init (priv->lock);


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