mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-22 13:48:09 +00:00
Add Python refcount increment in dealloc method to prevent reentrancy.
This commit is contained in:
parent
3519575570
commit
c15b02f271
1 changed files with 4 additions and 3 deletions
|
|
@ -432,15 +432,16 @@ class DeallocMethodDefinition(MethodDefinition):
|
|||
return "\tpylinphone_trace(1, \"[PYLINPHONE] >>> %s(%p [%p])\", __FUNCTION__, self, native_ptr);\n"
|
||||
|
||||
def format_c_function_call(self):
|
||||
native_ptr_dealloc_code = ''
|
||||
# Increment the refcount on self to prevent reentrancy in the dealloc method.
|
||||
native_ptr_dealloc_code = "\tPy_INCREF(self);\n"
|
||||
if self.class_['class_refcountable']:
|
||||
native_ptr_dealloc_code = \
|
||||
native_ptr_dealloc_code += \
|
||||
""" if (native_ptr != NULL) {{
|
||||
{function_prefix}unref(native_ptr);
|
||||
}}
|
||||
""".format(function_prefix=self.class_['class_c_function_prefix'])
|
||||
elif self.class_['class_destroyable']:
|
||||
native_ptr_dealloc_code = \
|
||||
native_ptr_dealloc_code += \
|
||||
""" if (native_ptr != NULL) {{
|
||||
{function_prefix}destroy(native_ptr);
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue