Index: net/proxy/proxy_config_service_linux.cc |
=================================================================== |
--- net/proxy/proxy_config_service_linux.cc (revision 14449) |
+++ net/proxy/proxy_config_service_linux.cc (working copy) |
@@ -8,7 +8,9 @@ |
#include <gdk/gdk.h> |
#include <stdlib.h> |
+#include "base/lock.h" |
#include "base/logging.h" |
+#include "base/message_pump_glib.h" |
#include "base/string_tokenizer.h" |
#include "base/string_util.h" |
#include "googleurl/src/url_canon.h" |
@@ -258,10 +260,17 @@ |
} |
virtual void Enter() { |
- gdk_threads_enter(); |
+ // Gconf is not thread-safe against itself, and it's meant to be |
+ // used from the thread running the glib main loop. The proxy |
+ // configuration is being fetched from the I/O thread, while the |
+ // glib main loop runs in the UI thread. gconf has callbacks, |
+ // timeouts and idles that will be dispatched from the glib main |
+ // loop. We take this lock to enforce mutual exclusion with the |
+ // glib main loop. |
+ base::MessagePumpForUI::glib_main_loop_lock_.Acquire(); |
} |
virtual void Leave() { |
- gdk_threads_leave(); |
+ base::MessagePumpForUI::glib_main_loop_lock_.Release(); |
} |
virtual bool InitIfNeeded() { |