This patch replaces all the ScriptedInterface object instance shared
pointer by a raw pointer. The reason behind the change is that when the
smart pointer gets re-assigned, that triggers calling the default
deleter to the previously pointer object.
However, in this case, the pointed memory was allocated in Python, so
when another object tries to read it, it causes a heap-use-after-free.
By switching to a raw pointer, it prevents lldb from decrementing the
reference counting to 0 and calling the deleter for that object.
rdar://87425859
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This doesn't sound right. This object (StructuredPythonObject instance) is definitely not created by python and will now be leaked. If I correctly understand the problem, the issue is that the this object gets a non-owning reference (the ret_val argument) to the underlying python object, and then frees it as if it was owning it. If that's the case, then the solution is to INCREF it in the constructor (or switch to using a PythonObject wrapper, which will then handle the lifetime management.
You may also be interested in D114722 (which I hope to update soon). It's not _directly_ related to this, but it touches the same parts of the code.