Fixing TnyCamelGetSupportedSecureAuthCallback error propagation.



May I commit the attached patch?

2007-09-04  Murray Cumming  <murrayc murrayc com>

	* libtinymail-camel/tny-camel-account.h: Change the 
	TnyCamelGetSupportedSecureAuthCallback callback to provide a
	GError* instead of a GError**, because it is not an output parameter.
	* libtinymail-camel/tny-camel-account.c: (on_supauth_idle_func),
(tny_camel_account_get_supported_secure_authentication_async_thread
	), (tny_camel_account_get_supported_secure_authentication):
	Adapt to the change, propagating GErrors up to the callback.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com
Index: libtinymail-camel/tny-camel-account.c
===================================================================
--- libtinymail-camel/tny-camel-account.c	(revision 2699)
+++ libtinymail-camel/tny-camel-account.c	(working copy)
@@ -1772,7 +1772,7 @@
 
 	if (info->callback) {
 		tny_lockable_lock (info->session->priv->ui_lock);
-		info->callback (info->self, info->cancelled, info->result, &info->err, info->user_data);
+		info->callback (info->self, info->cancelled, info->result, info->err, info->user_data);
 		tny_lockable_unlock (info->session->priv->ui_lock);
 	}
 
@@ -1837,6 +1837,7 @@
 	TNY_CAMEL_ACCOUNT_GET_CLASS(self)->prepare_func(self, FALSE, TRUE);
 
 	authtypes = camel_service_query_auth_types (priv->service, &ex);
+	
 	/* Result reference */
 	result = tny_simple_list_new ();
 	iter = authtypes;
@@ -1925,9 +1926,11 @@
 	if (!_tny_session_check_operation (priv->session, TNY_ACCOUNT (self), &err, 
 			TNY_ACCOUNT_ERROR, TNY_ACCOUNT_ERROR_GET_SUPPORTED_AUTH))
 	{
-		if (callback)
-			callback (self, TRUE /* cancelled */, NULL, &err, user_data);
-		g_error_free (err);
+		if (callback) {
+			/* Note: The callback must free the GError if it is not NULL: */
+			callback (self, TRUE /* cancelled */, NULL, err, user_data);
+		}
+		
 		return;
 	}
 
Index: libtinymail-camel/tny-camel-account.h
===================================================================
--- libtinymail-camel/tny-camel-account.h	(revision 2698)
+++ libtinymail-camel/tny-camel-account.h	(working copy)
@@ -107,7 +107,7 @@
 void tny_camel_account_set_online (TnyCamelAccount *self, gboolean online, TnyCamelSetOnlineCallback callback);
 
 
-typedef void (*TnyCamelGetSupportedSecureAuthCallback) (TnyCamelAccount *self, gboolean cancelled, TnyList *auth_types, GError **err, gpointer user_data);
+typedef void (*TnyCamelGetSupportedSecureAuthCallback) (TnyCamelAccount *self, gboolean cancelled, TnyList *auth_types, GError *err, gpointer user_data);
 void tny_camel_account_get_supported_secure_authentication(TnyCamelAccount *self, TnyCamelGetSupportedSecureAuthCallback callback, TnyStatusCallback status_callback, gpointer user_data);
 
 G_END_DECLS
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2702)
+++ ChangeLog	(working copy)
@@ -1,3 +1,13 @@
+2007-09-04  Murray Cumming  <murrayc murrayc com>
+
+	* libtinymail-camel/tny-camel-account.h: Change the 
+	TnyCamelGetSupportedSecureAuthCallback callback to provide a
+	GError* instead of a GError**, because it is not an output parameter.
+	* libtinymail-camel/tny-camel-account.c: (on_supauth_idle_func),
+	(tny_camel_account_get_supported_secure_authentication_async_thread
+	), (tny_camel_account_get_supported_secure_authentication):
+	Adapt to the change, propagating GErrors up to the callback.
+
 2007-09-04  Mark Doffman  <mark doffman codethink co uk>
 
 	* bindigs/python/*: restructuring the Python language bindings


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