aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-stopevent.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-09-08 14:26:43 -0600
committerTom Tromey <tom@tromey.com>2017-09-11 14:15:21 -0600
commit35c61a1dd5462ceab42618c48c9a60238245761b (patch)
treed74d1822708779e9d19ed23b5b2bc6c5917289e2 /gdb/python/py-stopevent.c
parent7c96f8c1dae023c7d0b1cabc5e50c4d18fd06960 (diff)
downloadgdb-35c61a1dd5462ceab42618c48c9a60238245761b.zip
gdb-35c61a1dd5462ceab42618c48c9a60238245761b.tar.gz
gdb-35c61a1dd5462ceab42618c48c9a60238245761b.tar.bz2
Small event ownership clean up in Python layer
It seems cleaner to me for functions like create_thread_event_object, which pass object ownership to their callers, to directly return a gdb_ref<>. This way the ownership transfer is part of the API. This patch makes this change. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * python/py-threadevent.c (create_thread_event_object): Return gdbpy_ref. * python/py-stopevent.h (create_stop_event_object) (create_breakpoint_event_object, create_signal_event_object): Update. * python/py-stopevent.c (create_stop_event_object): Return gdbpy_ref. (emit_stop_event): Update. * python/py-signalevent.c (create_signal_event_object): Return gdbpy_ref. * python/py-infevents.c (create_inferior_call_event_object): Update. * python/py-event.h (create_event_object) (create_thread_event_object): Update. * python/py-event.c (create_event_object): Return gdbpy_ref. * python/py-continueevent.c: Return gdbpy_ref. * python/py-bpevent.c (create_breakpoint_event_object): Return gdbpy_ref.
Diffstat (limited to 'gdb/python/py-stopevent.c')
-rw-r--r--gdb/python/py-stopevent.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/python/py-stopevent.c b/gdb/python/py-stopevent.c
index cfa4591..a0be5f2 100644
--- a/gdb/python/py-stopevent.c
+++ b/gdb/python/py-stopevent.c
@@ -20,7 +20,7 @@
#include "defs.h"
#include "py-stopevent.h"
-PyObject *
+gdbpy_ref<>
create_stop_event_object (PyTypeObject *py_type)
{
return create_thread_event_object (py_type);
@@ -70,8 +70,8 @@ emit_stop_event (struct bpstats *bs, enum gdb_signal stop_signal)
if (list != NULL)
{
- stop_event_obj.reset (create_breakpoint_event_object (list.get (),
- first_bp));
+ stop_event_obj = create_breakpoint_event_object (list.get (),
+ first_bp);
if (stop_event_obj == NULL)
return -1;
}
@@ -80,7 +80,7 @@ emit_stop_event (struct bpstats *bs, enum gdb_signal stop_signal)
if (stop_signal != GDB_SIGNAL_0
&& stop_signal != GDB_SIGNAL_TRAP)
{
- stop_event_obj.reset (create_signal_event_object (stop_signal));
+ stop_event_obj = create_signal_event_object (stop_signal);
if (stop_event_obj == NULL)
return -1;
}
@@ -89,7 +89,7 @@ emit_stop_event (struct bpstats *bs, enum gdb_signal stop_signal)
be known and this should eventually be unused. */
if (stop_event_obj == NULL)
{
- stop_event_obj.reset (create_stop_event_object (&stop_event_object_type));
+ stop_event_obj = create_stop_event_object (&stop_event_object_type);
if (stop_event_obj == NULL)
return -1;
}