Re: [RFC 8/8] mi/python: Allow redefinition of python MI commands

Jan Vrany
2019-05-07T11:26:47Z

On Mon, 2019-05-06 at 15:40 -0600, Tom Tromey wrote:
> Jan> Does above address your concern?
>
> The issue isn't a leak but rather the possibility of using an object
> after it's been destroyed.
>
> That is, if an MI command can be running when it is replaced, the code
> has to be sure that the command object isn't referenced after the
> replacement -- because the old object will have been destroyed.
>

I see. I just added a test for this case into "almost finished"
v2 of the patch series. There, this problem is kind of avoided by
making sure that in mi_command_py::invoke anything from "this"
mi_command_py object is not accessed AFTER calling the python code.

However I agree that using shared_ptr is more robust solution.

Thanks!

Jan

> Tom