Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2006-06-14 19:06:25 (GMT)
committer Dan Williams <dcbw@redhat.com>2006-06-14 19:06:25 (GMT)
commitca60226fb0819126c56549d82c59aa0305f57399 (patch)
tree39c68fc56784fe6f45d20dc5d4f57fcb709c5f54 /sugar
parent3ea146e17c8f1679d58fbc38b06734851673d9f9 (diff)
Do callbacks in an idle handler so we don't dbus deadlock at any point
Diffstat (limited to 'sugar')
-rw-r--r--sugar/shell/activity.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/sugar/shell/activity.py b/sugar/shell/activity.py
index d0cfacb..0e724be 100644
--- a/sugar/shell/activity.py
+++ b/sugar/shell/activity.py
@@ -5,7 +5,7 @@ import dbus.service
import dbus.glib
import pygtk
pygtk.require('2.0')
-import gtk
+import gtk, gobject
SHELL_SERVICE_NAME = "com.redhat.Sugar.Shell"
SHELL_SERVICE_PATH = "/com/redhat/Sugar/Shell"
@@ -57,9 +57,16 @@ class ActivityDbusService(dbus.service.Object):
return
self._callbacks[name] = callback
+ def _call_callback_cb(self, func, *args):
+ gobject.idle_add(func, *args)
+ return False
+
def _call_callback(self, name, *args):
+ """Call our activity object back, but from an idle handler
+ to minimize the possibility of stupid activities deadlocking
+ in dbus callbacks."""
if name in self._ALLOWED_CALLBACKS and self._callbacks[name]:
- self._callbacks[name](*args)
+ gobject.idle_add(self._call_callback_cb, self._callbacks[name], *args)
def connect_to_shell(self):
"""Register with the shell via dbus, getting an activity ID and