Call CloseHandle from ~windows_thread_info

Add a destructor to windows_thread_info that calls CloseHandle.

gdb/ChangeLog
2020-04-08  Tom Tromey  <tromey@adacore.com>

	* 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  <tromey@adacore.com>

	* win32-low.c (delete_thread_info): Don't call CloseHandle.
This commit is contained in:
Tom Tromey 2020-04-08 14:33:35 -06:00
parent 0a4afda3c6
commit 65bafd5b15
5 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2020-04-08 Tom Tromey <tromey@adacore.com>
* nat/windows-nat.h (struct windows_thread_info): Declare
destructor.
* nat/windows-nat.c (~windows_thread_info): New.
2020-04-08 Tom Tromey <tromey@adacore.com>
PR gdb/22992

View File

@ -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 ()
{

View File

@ -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. */

View File

@ -1,3 +1,7 @@
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (delete_thread_info): Don't call CloseHandle.
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (win32_require_context, suspend_one_thread): Use

View File

@ -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;
}