[review v4] Use run_on_main_thread in gdb.post_event

Pedro Alves (Code Review) gerrit@gnutoolchain-gerrit.osci.io
Tue Nov 26 19:26:00 GMT 2019


Pedro Alves has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/175
......................................................................


Patch Set 4: Code-Review+2

(1 comment)

Thanks for following through with doing this.

One comment about refcount handling.  Otherwise LGTM.

| --- gdb/python/python.c
| +++ gdb/python/python.c
| @@ -1017,16 +1030,7 @@ gdbpy_post_event (PyObject *self, PyObject *args)
| -  event = XNEW (struct gdbpy_event);
| -  event->event = func;
| -  event->next = NULL;
| -  *gdbpy_event_list_end = event;
| -  gdbpy_event_list_end = &event->next;
| -
| -  /* Wake up gdb when needed.  */
| -  if (wakeup)
| -    serial_event_set (gdbpy_serial_event);
| +  gdbpy_ref<> func_ref = gdbpy_ref<>::new_reference (func);

PS4, Line 1030:

gdbpy_ref<>::new_reference does incref inside, and I see there's an
Py_INCREF above.

I don't know whether it's correct or not, but it caught my eye.  Could
you double check?

| +  gdbpy_event event (std::move (func_ref));
| +  run_on_main_thread (event);
|  
|    Py_RETURN_NONE;
|  }
|  
| -/* Initialize the Python event handler.  */
| -static int
| -gdbpy_initialize_events (void)

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ie4431e60f328dae48bd96b6c6a8e875e70bda1de
Gerrit-Change-Number: 175
Gerrit-PatchSet: 4
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Pedro Alves <palves@redhat.com>
Gerrit-Comment-Date: Tue, 26 Nov 2019 19:25:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment



More information about the Gdb-patches mailing list