diff options
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/bindings/python/python-wrapper.swig | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index f9e8937..516590e 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -271,9 +271,6 @@ LLDBSwigPythonCreateScriptedThreadPlan if (python_class_name == NULL || python_class_name[0] == '\0' || !session_dictionary_name) Py_RETURN_NONE; - // I do not want the SBThreadPlan to be deallocated when going out of scope because python - // has ownership of it and will manage memory for this object by itself - lldb::SBThreadPlan *tp_value = new lldb::SBThreadPlan(thread_plan_sp); PyErr_Cleaner py_err_cleaner(true); @@ -286,7 +283,10 @@ LLDBSwigPythonCreateScriptedThreadPlan return nullptr; } - PythonObject tp_arg(PyRefType::Owned, SBTypeToSWIGWrapper(tp_value)); + // I do not want the SBThreadPlan to be deallocated when going out of scope + // because python has ownership of it and will manage memory for this + // object by itself + PythonObject tp_arg(PyRefType::Owned, SBTypeToSWIGWrapper(new lldb::SBThreadPlan(thread_plan_sp))); if (!tp_arg.IsAllocated()) Py_RETURN_NONE; @@ -312,8 +312,7 @@ LLDBSwigPythonCreateScriptedThreadPlan } result = pfunc(tp_arg, dict); } else if (arg_info.get().max_positional_args >= 3) { - lldb::SBStructuredData *args_value = new lldb::SBStructuredData(args_impl); - PythonObject args_arg(PyRefType::Owned, SBTypeToSWIGWrapper(args_value)); + PythonObject args_arg(PyRefType::Owned, SBTypeToSWIGWrapper(new lldb::SBStructuredData(args_impl))); result = pfunc(tp_arg, args_arg, dict); } else { error_string.assign("wrong number of arguments in __init__, should be 2 or 3 (not including self)"); |