From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id 204C03AAA06B for ; Fri, 13 Mar 2020 19:09:01 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 1A0CA561B8; Fri, 13 Mar 2020 15:09:01 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Ht6+5WZSgU5U; Fri, 13 Mar 2020 15:09:01 -0400 (EDT) Received: from murgatroyd.Home (184-96-250-69.hlrn.qwest.net [184.96.250.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id BAAF3561B0; Fri, 13 Mar 2020 15:09:00 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v3 12/29] Call CloseHandle from ~windows_thread_info Date: Fri, 13 Mar 2020 13:08:38 -0600 Message-Id: <20200313190855.28662-13-tromey@adacore.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200313190855.28662-1-tromey@adacore.com> References: <20200313190855.28662-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-25.0 required=5.0 tests=GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2020 19:09:01 -0000 Add a destructor to windows_thread_info that calls CloseHandle. gdb/ChangeLog 2020-03-13 Tom Tromey * nat/windows-nat.h (struct windows_thread_info): Declare destructor. * nat/windows-nat.c (~windows_thread_info): New. gdbserver/ChangeLog 2020-03-13 Tom Tromey * win32-low.c (delete_thread_info): Don't call CloseHandle. --- gdb/ChangeLog | 6 ++++++ gdb/nat/windows-nat.c | 5 +++++ gdb/nat/windows-nat.h | 2 ++ gdbserver/ChangeLog | 4 ++++ gdbserver/win32-low.cc | 1 - 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c index 767ed8c192f..ca3e3087944 100644 --- a/gdb/nat/windows-nat.c +++ b/gdb/nat/windows-nat.c @@ -19,6 +19,11 @@ #include "gdbsupport/common-defs.h" #include "nat/windows-nat.h" +windows_thread_info::~windows_thread_info () +{ + CloseHandle (h); +} + void windows_thread_info::suspend () { diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h index 224ae5c536c..ccdf207140e 100644 --- a/gdb/nat/windows-nat.h +++ b/gdb/nat/windows-nat.h @@ -32,6 +32,8 @@ struct windows_thread_info { } + ~windows_thread_info (); + DISABLE_COPY_AND_ASSIGN (windows_thread_info); /* Ensure that this thread has been suspended. */ diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 7cad640878f..c642d47764c 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -218,7 +218,6 @@ delete_thread_info (thread_info *thread) windows_thread_info *th = (windows_thread_info *) thread_target_data (thread); remove_thread (thread); - CloseHandle (th->h); delete th; } -- 2.21.1