summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2005-08-30 15:21:04 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2005-08-30 15:21:04 +0000
commit46a1e648fe1c86dc33df799fddf97659ddc17063 (patch)
tree4251ed0235a765c7bbd0a042067cc8d1e0524d90
parentb701a78aca32394ff18a630f029cc75dbd34bc9e (diff)
* python/dbus_bindings.pyx (_pending_call_notification): Obtain the
GIL global lock when calling back into Python
-rw-r--r--ChangeLog5
-rw-r--r--python/dbus_bindings.pyx25
2 files changed, 20 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 0bb0c24b..c36be7ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-30 John (J5) Palmieri <johnp@redhat.com>
+
+ * python/dbus_bindings.pyx (_pending_call_notification): Obtain the
+ GIL global lock when calling back into Python
+
2005-08-29 John (J5) Palmieri <johnp@redhat.com>
* Release 0.36.2
diff --git a/python/dbus_bindings.pyx b/python/dbus_bindings.pyx
index ee3e648d..6973944a 100644
--- a/python/dbus_bindings.pyx
+++ b/python/dbus_bindings.pyx
@@ -490,6 +490,7 @@ cdef class Connection:
cdef void _pending_call_notification(DBusPendingCall *pending_call, void *user_data):
cdef DBusMessage *dbus_message
cdef Message message
+ cdef PyGILState_STATE gil
(reply_handler, error_handler) = <object>user_data
@@ -499,17 +500,21 @@ cdef void _pending_call_notification(DBusPendingCall *pending_call, void *user_d
type = message.get_type()
- if type == MESSAGE_TYPE_METHOD_RETURN:
- args = message.get_args_list()
- reply_handler(*args)
- elif type == MESSAGE_TYPE_ERROR:
- args = message.get_args_list()
- if len(args) > 0:
- error_handler(DBusException(args[0]))
+ gil = PyGILState_Ensure()
+ try:
+ if type == MESSAGE_TYPE_METHOD_RETURN:
+ args = message.get_args_list()
+ reply_handler(*args)
+ elif type == MESSAGE_TYPE_ERROR:
+ args = message.get_args_list()
+ if len(args) > 0:
+ error_handler(DBusException(args[0]))
+ else:
+ error_handler(DBusException(""))
else:
- error_handler(DBusException(""))
- else:
- error_handler(DBusException('Unexpected Message Type: ' + message.type_to_name(type)))
+ error_handler(DBusException('Unexpected Message Type: ' + message.type_to_name(type)))
+ finally:
+ PyGILState_Release(gil)
dbus_message_unref(dbus_message)
dbus_pending_call_unref(pending_call)