From: Tom Tromey Date: Wed, 8 Apr 2020 20:33:35 +0000 (-0600) Subject: Call CloseHandle from ~windows_thread_info X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=65bafd5b156bcb4f308f304e55a03e13f4eb2bed;p=deliverable%2Fbinutils-gdb.git Call CloseHandle from ~windows_thread_info Add a destructor to windows_thread_info that calls CloseHandle. gdb/ChangeLog 2020-04-08 Tom Tromey * nat/windows-nat.h (struct windows_thread_info): Declare destructor. * nat/windows-nat.c (~windows_thread_info): New. gdbserver/ChangeLog 2020-04-08 Tom Tromey * win32-low.c (delete_thread_info): Don't call CloseHandle. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 83aa877c03..91f84c68c9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-04-08 Tom Tromey + + * nat/windows-nat.h (struct windows_thread_info): Declare + destructor. + * nat/windows-nat.c (~windows_thread_info): New. + 2020-04-08 Tom Tromey PR gdb/22992 diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c index 767ed8c192..ca3e308794 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 224ae5c536..ccdf207140 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/ChangeLog b/gdbserver/ChangeLog index 29d176071c..e72741357d 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2020-04-08 Tom Tromey + + * win32-low.c (delete_thread_info): Don't call CloseHandle. + 2020-04-08 Tom Tromey * win32-low.c (win32_require_context, suspend_one_thread): Use diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 7cad640878..c642d47764 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; }