[maemo-commits] [maemo-commits] r13592 - in projects/haf/trunk/osso-gnome-vfs2/debian: . patches

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Sep 5 11:04:54 EEST 2007
Author: richard
Date: 2007-09-05 11:04:51 +0300 (Wed, 05 Sep 2007)
New Revision: 13592

Modified:
   projects/haf/trunk/osso-gnome-vfs2/debian/changelog
   projects/haf/trunk/osso-gnome-vfs2/debian/patches/35-NB63225-gconf-race-condition.patch
Log:
Rework the fix.


Modified: projects/haf/trunk/osso-gnome-vfs2/debian/changelog
===================================================================
--- projects/haf/trunk/osso-gnome-vfs2/debian/changelog	2007-09-05 06:53:27 UTC (rev 13591)
+++ projects/haf/trunk/osso-gnome-vfs2/debian/changelog	2007-09-05 08:04:51 UTC (rev 13592)
@@ -1,3 +1,9 @@
+osso-gnome-vfs2 (2.16.3-1osso28) unstable; urgency=low
+
+  * Rework the fix for NB#66755 to be correct.
+	
+ -- Richard Hult <richard at imendio.com>  Wed,  5 Sep 2007 09:02:14 +0200
+
 osso-gnome-vfs2 (2.16.3-1osso27) unstable; urgency=low
 
   * Fixes: NB#66755, proxy_init cb not getting called in time
@@ -2,3 +8,3 @@
 	
- -- Martyn Russell <martyn at imendio.com>  Tue, 28 Sep 2007 15:30:00 +0100
+ -- Martyn Russell <martyn at imendio.com>  Tue, 28 Aug 2007 15:30:00 +0100
 

Modified: projects/haf/trunk/osso-gnome-vfs2/debian/patches/35-NB63225-gconf-race-condition.patch
===================================================================
--- projects/haf/trunk/osso-gnome-vfs2/debian/patches/35-NB63225-gconf-race-condition.patch	2007-09-05 06:53:27 UTC (rev 13591)
+++ projects/haf/trunk/osso-gnome-vfs2/debian/patches/35-NB63225-gconf-race-condition.patch	2007-09-05 08:04:51 UTC (rev 13592)
@@ -1,82 +1,49 @@
 Index: modules/http-proxy.c
 ===================================================================
---- modules/http-proxy.c	(revision 13435)
-+++ modules/http-proxy.c	(working copy)
-@@ -52,7 +52,7 @@
- 
- /* Global variables used by the HTTP proxy config */
- static GConfClient *gl_client = NULL;
--static GMutex *gl_mutex = NULL;	/* This mutex protects preference values
-+G_LOCK_DEFINE_STATIC(gl_mutex);	/* This mutex protects preference values
- 				 * and ensures serialization of authentication
- 				 * hook callbacks       
- 				 */
-@@ -247,7 +247,7 @@ gboolean proxy_for_uri (GnomeVFSToplevel
- 
-     ret = proxy_should_for_hostname (toplevel_uri->host_name);
- 
--    g_mutex_lock (gl_mutex);
-+    G_LOCK(gl_mutex);
- 
-     if (ret && gl_http_proxy != NULL) {
- 	ret = host_port_from_string(gl_http_proxy, &(proxy_info->host),
-@@ -263,7 +263,7 @@ gboolean proxy_for_uri (GnomeVFSToplevel
- 	ret = FALSE;
+--- modules/http-proxy.c	(revision 13555)
++++ modules/http-proxy.c	(arbetskopia)
+@@ -524,14 +524,16 @@ notify_gconf_value_changed(GConfClient *
      }
- 
--    g_mutex_unlock(gl_mutex);
-+    G_UNLOCK(gl_mutex);
- 
-     return ret;
  }
-@@ -499,7 +499,7 @@ notify_gconf_value_changed(GConfClient *
- 	|| strcmp(key, KEY_GCONF_HTTP_PROXY_PORT) == 0) {
- 	gboolean use_proxy_value;
  
--	g_mutex_lock(gl_mutex);
-+	G_LOCK(gl_mutex);
- 
- 	/* Check and see if we are using the proxy */
- 	use_proxy_value =
-@@ -507,20 +507,20 @@ notify_gconf_value_changed(GConfClient *
- 				  KEY_GCONF_USE_HTTP_PROXY, NULL);
- 	construct_gl_http_proxy(use_proxy_value);
- 
--	g_mutex_unlock(gl_mutex);
-+	G_UNLOCK(gl_mutex);
-     } else if (strcmp(key, KEY_GCONF_HTTP_AUTH_USER) == 0
- 	       || strcmp(key, KEY_GCONF_HTTP_AUTH_PW) == 0
- 	       || strcmp(key, KEY_GCONF_HTTP_USE_AUTH) == 0) {
- 	gboolean use_proxy_auth;
- 
--	g_mutex_lock(gl_mutex);
-+	G_LOCK(gl_mutex);
- 
- 	use_proxy_auth =
- 	    gconf_client_get_bool(gl_client,
- 				  KEY_GCONF_HTTP_USE_AUTH, NULL);
- 	set_proxy_auth(use_proxy_auth);
- 
--	g_mutex_unlock(gl_mutex);
-+	G_UNLOCK(gl_mutex);
-     }
- }
- 
-@@ -530,8 +530,8 @@ void proxy_init(void)
+-void proxy_init(void)
++static gboolean 
++proxy_init_cb (gpointer user_data)
+ {
+     GError *gconf_error = NULL;
      gboolean use_proxy;
      gboolean use_proxy_auth;
  
-+    G_LOCK(gl_mutex);
++    g_mutex_lock(gl_mutex);
++
      gl_client = gconf_client_get_default();
 -    gl_mutex = g_mutex_new();
  
      gconf_client_add_dir(gl_client, PATH_GCONF_GNOME_VFS,
  			 GCONF_CLIENT_PRELOAD_ONELEVEL, &gconf_error);
-@@ -551,6 +551,7 @@ void proxy_init(void)
- 	g_error_free(gconf_error);
- 	gconf_error = NULL;
+@@ -578,6 +580,25 @@ void proxy_init(void)
+     } else {
+ 	set_proxy_auth(use_proxy_auth);
      }
-+    G_UNLOCK(gl_mutex);
++
++    g_mutex_unlock(gl_mutex);
++
++    return FALSE;
++}
++
++void proxy_init(void)
++{
++    gl_mutex = g_mutex_new();
++
++    /* This fixes NB#63225:
++     *
++     * This is a work around to a race condition caused by the GConf API being
++     * used in a thread, which is not allowed since GConf isn't thread safe. We
++     * use g_idle_add() here to do the GConf calls from the main thread. Note,
++     * this is fine where we have a main loop, but in cases where we don't have
++     * a main loop this work around is not effective.
++     */
++    g_idle_add (proxy_init_cb, NULL);
+ }
  
-     /* Load the http proxy setting */
-     use_proxy =
+ 


More information about the maemo-commits mailing list