From 5719dd8e928568047be9063dbc333ab1b8a17f90 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 28 Aug 2014 15:15:10 +0200 Subject: [PATCH] Revert "Remove wrong decrementation of refcount in the event callbacks of the Python wrapper." This reverts commit aa05370dce61c9223d67c0684b26db3c7258562a. --- tools/python/apixml2python/linphone.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/python/apixml2python/linphone.py b/tools/python/apixml2python/linphone.py index 2c671d453..8a4dd0a98 100644 --- a/tools/python/apixml2python/linphone.py +++ b/tools/python/apixml2python/linphone.py @@ -741,6 +741,7 @@ class EventCallbackMethodDefinition(MethodDefinition): def format_c_function_call(self): create_python_objects_code = '' + decref_python_objects_code = '' fmt = 'O' args = ['pylc'] for xml_method_arg in self.xml_method_args: @@ -767,6 +768,7 @@ class EventCallbackMethodDefinition(MethodDefinition): {new_from_native_pointer_code} }} """.format(name=arg_name, get_user_data_code=get_user_data_code, new_from_native_pointer_code=new_from_native_pointer_code) + decref_python_objects_code += "\t\tPy_DECREF(py{name});\n".format(name=arg_name) args=', '.join(args) return \ """ if ((func != NULL) && PyCallable_Check(func)) {{ @@ -774,8 +776,9 @@ class EventCallbackMethodDefinition(MethodDefinition): if (PyEval_CallObject(func, Py_BuildValue("{fmt}", {args})) == NULL) {{ PyErr_Print(); }} +{decref_python_objects_code} }} -""".format(fmt=fmt.replace('O', 'N'), args=args, create_python_objects_code=create_python_objects_code) +""".format(fmt=fmt.replace('O', 'N'), args=args, create_python_objects_code=create_python_objects_code, decref_python_objects_code=decref_python_objects_code) def format_return_trace(self): return "\tpylinphone_trace(-1, \"[PYLINPHONE] <<< %s\", __FUNCTION__);\n"