public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Check for listeners in emit_exiting_event
@ 2022-06-15 20:07 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2022-06-15 20:07 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9d741cbedb8a7a77bb7c99bbbc363d5af4ba62c2

commit 9d741cbedb8a7a77bb7c99bbbc363d5af4ba62c2
Author: Tom Tromey <tromey@adacore.com>
Date:   Fri Jun 3 10:39:11 2022 -0600

    Check for listeners in emit_exiting_event
    
    I noticed that emit_exiting_event does not check whether there are any
    listeners before creating the event object.  All other event emitters
    do this, so this patch updates this one as well.

Diff:
---
 gdb/python/python.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 079c260fc7f..7faad2bfa35 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1938,6 +1938,9 @@ init__gdb_module (void)
 static int
 emit_exiting_event (int exit_code)
 {
+  if (evregpy_no_listeners_p (gdb_py_events.gdb_exiting))
+    return 0;
+
   gdbpy_ref<> event_obj = create_event_object (&gdb_exiting_event_object_type);
   if (event_obj == nullptr)
     return -1;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-15 20:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 20:07 [binutils-gdb] Check for listeners in emit_exiting_event Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).