[review v4] Use run_on_main_thread in gdb.post_event

Tom Tromey (Code Review) gerrit@gnutoolchain-gerrit.osci.io
Tue Nov 26 19:53:00 GMT 2019


Tom Tromey has posted comments on this change.

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


Patch Set 4:

(1 comment)

| --- 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?

Thanks for noticing this.  I removed the incref here.

| +  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-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Tue, 26 Nov 2019 19:52:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Pedro Alves <palves@redhat.com>
Gerrit-MessageType: comment



More information about the Gdb-patches mailing list