From: Tobias Mueller Date: Fri, 8 Aug 2008 14:39:50 +0000 (+0200) Subject: Initialize provider_table in camel in case we haven't already X-Git-Tag: upstream/3.7.4~4048 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f9d37fa3b167af3cc5daa77a7a27a4c0857c3b4;p=platform%2Fupstream%2Fevolution-data-server.git Initialize provider_table in camel in case we haven't already Call camel_type_init in camel_provider_list in camel/camel-provider.c in case it we haven't already. Fixes bug 549094. --- diff --git a/camel/camel-object.c b/camel/camel-object.c index 4418262..2645c84 100644 --- a/camel/camel-object.c +++ b/camel/camel-object.c @@ -713,6 +713,8 @@ co_type_register(CamelType parent, const char * name, TYPE_LOCK(); + camel_type_init(); /* has a static boolean itself */ + /* Have to check creation, it might've happened in another thread before we got here */ klass = g_hash_table_lookup(type_table, name); if (klass != NULL) { diff --git a/camel/camel-provider.c b/camel/camel-provider.c index ca6b74c..db20688 100644 --- a/camel/camel-provider.c +++ b/camel/camel-provider.c @@ -298,7 +298,12 @@ camel_provider_list(gboolean load) { GList *list = NULL; - g_assert(provider_table); + + /* provider_table can be NULL, so initialize it */ + if (G_UNLIKELY (provider_table == NULL)) + camel_provider_init (); + + g_return_val_if_fail (provider_table != NULL, NULL); LOCK(); @@ -344,8 +349,8 @@ camel_provider_get(const char *url_string, CamelException *ex) char *protocol; size_t len; - g_return_val_if_fail(url_string != NULL, NULL); - g_assert(provider_table); + g_return_val_if_fail (url_string != NULL, NULL); + g_return_val_if_fail (provider_table != NULL, NULL); len = strcspn(url_string, ":"); protocol = g_alloca(len+1);