[review] Call CloseHandle from ~windows_thread_info
Commit Message
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/706
......................................................................
Call CloseHandle from ~windows_thread_info
Add a destructor to windows_thread_info that calls CloseHandle.
gdb/ChangeLog
2019-11-26 Tom Tromey <tromey@adacore.com>
* nat/windows-nat.h (struct windows_thread_info): Declare
destructor.
* nat/windows-nat.c (~windows_thread_info): New.
gdb/gdbserver/ChangeLog
2019-11-26 Tom Tromey <tromey@adacore.com>
* win32-low.c (delete_thread_info): Don't call CloseHandle.
Change-Id: I4bae7f2551aa55be2bc5bd93d566a5c2e369247f
---
M gdb/ChangeLog
M gdb/gdbserver/ChangeLog
M gdb/gdbserver/win32-low.c
M gdb/nat/windows-nat.c
M gdb/nat/windows-nat.h
5 files changed, 17 insertions(+), 1 deletion(-)
Comments
Pedro Alves has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/706
......................................................................
Patch Set 1: Code-Review+2
@@ -1,5 +1,11 @@
2019-11-26 Tom Tromey <tromey@adacore.com>
+ * nat/windows-nat.h (struct windows_thread_info): Declare
+ destructor.
+ * nat/windows-nat.c (~windows_thread_info): New.
+
+2019-11-26 Tom Tromey <tromey@adacore.com>
+
PR gdb/22992
* windows-nat.c (current_event): Update comment.
(last_wait_event, desired_stop_thread_id): New globals.
@@ -1,5 +1,9 @@
2019-11-26 Tom Tromey <tromey@adacore.com>
+ * win32-low.c (delete_thread_info): Don't call CloseHandle.
+
+2019-11-26 Tom Tromey <tromey@adacore.com>
+
* win32-low.c (win32_require_context, suspend_one_thread): Use
windows_thread_info::suspend.
(continue_one_thread): Use windows_thread_info::resume.
@@ -219,7 +219,6 @@
windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
remove_thread (thread);
- CloseHandle (th->h);
delete th;
}
@@ -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 ()
{
@@ -32,6 +32,8 @@
{
}
+ ~windows_thread_info ();
+
DISABLE_COPY_AND_ASSIGN (windows_thread_info);
/* Ensure that this thread has been suspended. */