summaryrefslogtreecommitdiffstats
path: root/swig
diff options
context:
space:
mode:
authorGravatar Bryan Forbes2010-03-09 10:29:11 -0600
committerGravatar Bryan Forbes2010-03-09 10:29:11 -0600
commitc01f740e26a5c0ac2aa13200cacd50890f125c06 (patch)
tree20ccda33748984ffa739b90028a302d505e33da9 /swig
parent6ceabe1e0a3c107c4b98d38f59f044b8eb7731a0 (diff)
downloadlibimobiledevice-c01f740e26a5c0ac2aa13200cacd50890f125c06.tar.gz
libimobiledevice-c01f740e26a5c0ac2aa13200cacd50890f125c06.tar.bz2
Updated the SWIG bindings for the userdata parameter to np_set_notify_callback.
Diffstat (limited to 'swig')
-rw-r--r--swig/imobiledevice.i18
1 files changed, 6 insertions, 12 deletions
diff --git a/swig/imobiledevice.i b/swig/imobiledevice.i
index 3c9fd3c..2de69e7 100644
--- a/swig/imobiledevice.i
+++ b/swig/imobiledevice.i
@@ -122,20 +122,15 @@ static PList::Node* new_node_from_plist(plist_t node)
}
#ifdef SWIGPYTHON
-PyObject* python_callback = NULL;
-
-static void NotificationProxyPythonCallback(const char *notification) {
- PyObject *arglist;
- PyGILState_STATE gstate;
+static void NotificationProxyPythonCallback(const char *notification, void* user_data) {
+ PyObject *func, *arglist;
+ func = (PyObject *) user_data;
arglist = Py_BuildValue("(s)",notification);
- gstate = PyGILState_Ensure();
-
- PyEval_CallObject(python_callback, arglist);
+ PyEval_CallObject(func, arglist);
- Py_XDECREF(arglist);
- PyGILState_Release(gstate);
+ Py_DECREF(arglist);
}
#endif
%}
@@ -338,8 +333,7 @@ typedef struct {
%extend NotificationProxy {
int16_t set_callback(PyObject *pyfunc) {
int16_t res;
- python_callback = pyfunc;
- res = np_set_notify_callback($self->client, NotificationProxyPythonCallback);
+ res = np_set_notify_callback($self->client, NotificationProxyPythonCallback, (void *) pyfunc);
Py_INCREF(pyfunc);
return res;
}