diff options
author | Tom Tromey <tromey@adacore.com> | 2024-06-11 14:10:08 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-06-13 10:13:36 -0600 |
commit | 7c03e522d4e059a7c59533e4b01771a7cc4bb68e (patch) | |
tree | dd852f7f61ce526ff61b5eb98977d73463703a9f /gdb/python/py-tui.c | |
parent | 54904469f71c06102e15707c2cb4964e496a8ed6 (diff) | |
download | binutils-7c03e522d4e059a7c59533e4b01771a7cc4bb68e.zip binutils-7c03e522d4e059a7c59533e4b01771a7cc4bb68e.tar.gz binutils-7c03e522d4e059a7c59533e4b01771a7cc4bb68e.tar.bz2 |
Return gdbpy_ref<> from gdbpy_call_method
This changes gdbpy_call_method to return a gdbpy_ref<>. This is
slightly safer because it makes it simpler to correctly handle
reference counts.
Reviewed-By: Tom de Vries <tdevries@suse.de>
Diffstat (limited to 'gdb/python/py-tui.c')
-rw-r--r-- | gdb/python/py-tui.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c index 9df86df..901f6fe 100644 --- a/gdb/python/py-tui.c +++ b/gdb/python/py-tui.c @@ -164,7 +164,7 @@ tui_py_window::~tui_py_window () if (m_window != nullptr && PyObject_HasAttrString (m_window.get (), "close")) { - gdbpy_ref<> result (gdbpy_call_method (m_window.get (), "close")); + gdbpy_ref<> result = gdbpy_call_method (m_window.get (), "close"); if (result == nullptr) gdbpy_print_stack (); } @@ -197,7 +197,7 @@ tui_py_window::rerender () if (PyObject_HasAttrString (m_window.get (), "render")) { - gdbpy_ref<> result (gdbpy_call_method (m_window.get (), "render")); + gdbpy_ref<> result = gdbpy_call_method (m_window.get (), "render"); if (result == nullptr) gdbpy_print_stack (); } @@ -210,8 +210,8 @@ tui_py_window::do_scroll_horizontal (int num_to_scroll) if (PyObject_HasAttrString (m_window.get (), "hscroll")) { - gdbpy_ref<> result (gdbpy_call_method (m_window.get (), "hscroll", - num_to_scroll)); + gdbpy_ref<> result = gdbpy_call_method (m_window.get(), "hscroll", + num_to_scroll); if (result == nullptr) gdbpy_print_stack (); } @@ -224,8 +224,8 @@ tui_py_window::do_scroll_vertical (int num_to_scroll) if (PyObject_HasAttrString (m_window.get (), "vscroll")) { - gdbpy_ref<> result (gdbpy_call_method (m_window.get (), "vscroll", - num_to_scroll)); + gdbpy_ref<> result = gdbpy_call_method (m_window.get (), "vscroll", + num_to_scroll); if (result == nullptr) gdbpy_print_stack (); } @@ -246,8 +246,8 @@ tui_py_window::click (int mouse_x, int mouse_y, int mouse_button) if (PyObject_HasAttrString (m_window.get (), "click")) { - gdbpy_ref<> result (gdbpy_call_method (m_window.get (), "click", - mouse_x, mouse_y, mouse_button)); + gdbpy_ref<> result = gdbpy_call_method (m_window.get (), "click", + mouse_x, mouse_y, mouse_button); if (result == nullptr) gdbpy_print_stack (); } |