? test.html? deskbar/handlers/debug-blockinginit.pyIndex: deskbar/handler.py===================================================================RCS file: /cvs/gnome/deskbar-applet/deskbar/handler.py,vretrieving revision 1.3diff -u -p -r1.3 handler.py--- deskbar/handler.py 14 Oct 2005 13:22:57 -0000 1.3+++ deskbar/handler.py 14 Oct 2005 13:36:51 -0000@@ -103,6 +103,10 @@ class Handler: Handler.initialize() is guarantied to be called before the handler is queried.+ + If you need to perform gtk-related function you might want to use+ initialize_safe() instead of initialize(), the module loader will ensure+ gtk.threads_enter/leave is called appropriately. """ passIndex: deskbar/module_list.py===================================================================RCS file: /cvs/gnome/deskbar-applet/deskbar/module_list.py,vretrieving revision 1.4diff -u -p -r1.4 module_list.py--- deskbar/module_list.py 14 Oct 2005 13:22:57 -0000 1.4+++ deskbar/module_list.py 14 Oct 2005 13:36:51 -0000@@ -261,13 +261,9 @@ class ModuleLoader (gobject.GObject): while True: task = self.task_queue.get() try:- gtk.threads_enter ()- try:- task ()- except Exception, msg:- print 'Error:consume_queue:Got an error while processing item:', msg- finally:- gtk.threads_leave ()+ task ()+ except Exception, msg:+ print 'Error:consume_queue:Got an error while processing item:', msg def build_filelist (self): """Returns a list containing the filenames of all qualified modules.@@ -315,12 +311,12 @@ class ModuleLoader (gobject.GObject): print >> sys.stderr, "***" return- try:- if (getattr(mod, mod.EXPORTED_CLASS).initialize) : pass- except AttributeError:+ if hasattr(getattr(mod, mod.EXPORTED_CLASS), "initialize") or hasattr(getattr(mod, mod.EXPORTED_CLASS), "initialize_safe"):+ pass+ else: print >> sys.stderr, "Class %s in file %s does not have an initialize(self) method. Skipping." % (mod.EXPORTED_CLASS, filename) return- + return mod def load_all (self):@@ -362,7 +358,17 @@ class ModuleLoader (gobject.GObject): """ print "Initializing '%s'" % context.name- context.module.initialize ()+ + # First we check if the module must be called in a thread safe way+ if hasattr(context.module, "initialize_safe"):+ gtk.threads_enter ()+ try:+ context.module.initialize_safe()+ finally:+ gtk.threads_leave ()+ # Else we use the simple non-locked method+ else:+ context.module.initialize () context.enabled = True gobject.idle_add (self.emit, "module-initialized", context)Index: deskbar/handlers/networkplaces.py===================================================================RCS file: /cvs/gnome/deskbar-applet/deskbar/handlers/networkplaces.py,vretrieving revision 1.2diff -u -p -r1.2 networkplaces.py--- deskbar/handlers/networkplaces.py 14 Oct 2005 13:22:57 -0000 1.2+++ deskbar/handlers/networkplaces.py 14 Oct 2005 13:36:51 -0000@@ -31,7 +31,7 @@ class NetworkPlacesHandler(deskbar.handl self._indexer = deskbar.indexer.Index()- def initialize(self):+ def initialize_safe(self): self._scan_network_places() def get_priority(self):