[PATCH] Fix crash when TUI window creation fails
Pedro Alves
palves@redhat.com
Tue Jun 16 22:08:54 GMT 2020
On 6/16/20 9:26 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> Is this "the Python function" referring to this PyObject_CallFunctionObjArgs
> Pedro> call (*)?
>
> Yep.
>
> Pedro> std::unique_ptr<tui_py_window> window
> Pedro> (new tui_py_window (win_name, wrapper));
>
> Pedro> gdbpy_ref<> user_window
> Pedro> (PyObject_CallFunctionObjArgs (m_constr.get (),
> Pedro> (PyObject *) wrapper.get (),
> Pedro> nullptr));
> Pedro> if (user_window == nullptr)
> Pedro> {
> Pedro> gdbpy_print_stack ();
> Pedro> return nullptr;
> Pedro> }
>
> window-> set_user_window (std::move (user_window));
>
> Pedro> Wouldn't it make sense to to move the tui_py_window
> Pedro> allocation until after the Python call instead?
>
> No, because the TUI window object is passed to the user's constructor,
> and that constructor can write text there, etc.
>
> Pedro> (*) - I think the comment would gain from mentioning
> Pedro> it more specifically, like 'the Python "contructor" function'
> Pedro> or something like that.
>
> I'll update it.
Thanks for the clarification. Feel free to merge with that
update then.
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list