From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 2544038582B4; Wed, 15 Jun 2022 20:07:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2544038582B4 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Check for listeners in emit_exiting_event X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 285dfa0f6877ea7677e84c3c1001c5d339fbbe5e X-Git-Newrev: 9d741cbedb8a7a77bb7c99bbbc363d5af4ba62c2 Message-Id: <20220615200758.2544038582B4@sourceware.org> Date: Wed, 15 Jun 2022 20:07:58 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jun 2022 20:07:58 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D9d741cbedb8a= 7a77bb7c99bbbc363d5af4ba62c2 commit 9d741cbedb8a7a77bb7c99bbbc363d5af4ba62c2 Author: Tom Tromey Date: Fri Jun 3 10:39:11 2022 -0600 Check for listeners in emit_exiting_event =20 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 =3D create_event_object (&gdb_exiting_event_object= _type); if (event_obj =3D=3D nullptr) return -1;