[Sugar-devel] [PATCH] sugar-session: initialize threading via glib

Daniel Drake dsd at laptop.org
Sat Oct 13 18:12:24 EDT 2012


sugar extensions that use threads such as OLPC's software updater
require that threads have been properly initialised before the
main loop is ran.

For pygobject3, GLib.threads_init() must be called before doing
the same for Gdk, otherwise the threads hang in random places
for long periods of time. See e.g.
http://stackoverflow.com/questions/11070263/webkit-threads-with-pygobject-on-gtk3
---
 bin/sugar-session | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bin/sugar-session b/bin/sugar-session
index 7455f38..6f2bcd6 100755
--- a/bin/sugar-session
+++ b/bin/sugar-session
@@ -35,6 +35,7 @@ import gettext
 import logging
 import sys
 
+from gi.repository import GLib
 from gi.repository import GConf
 from gi.repository import Gtk
 from gi.repository import Gdk
@@ -51,6 +52,7 @@ try:
 except ImportError:
     logging.debug('Could not load xklavier for keyboard configuration')
 
+GLib.threads_init()
 Gdk.threads_init()
 dbus.glib.threads_init()
 
-- 
1.7.11.4



More information about the Sugar-devel mailing list