Call CloseHandle from ~windows_thread_info
authorTom Tromey <tromey@adacore.com>
Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 8 Apr 2020 20:47:58 +0000 (14:47 -0600)
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.

gdb/ChangeLog
gdb/nat/windows-nat.c
gdb/nat/windows-nat.h
gdbserver/ChangeLog
gdbserver/win32-low.cc

index 83aa877c0378bcdf5b35d966a811d0c77673a518..91f84c68c91ef14c5c66eff1cd8a989cd04c5b59 100644 (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
index 767ed8c192fa84534ebd22286e4772757291a295..ca3e3087944ff0a41677e6e837c1bc8a5d5f2de7 100644 (file)
 #include "gdbsupport/common-defs.h"
 #include "nat/windows-nat.h"
 
+windows_thread_info::~windows_thread_info ()
+{
+  CloseHandle (h);
+}
+
 void
 windows_thread_info::suspend ()
 {
index 224ae5c536cbd65803170b81bf8203df9f18eb6b..ccdf207140e986e649a355d800a9f40cc1afeba4 100644 (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.  */
index 29d176071ca25283ff316dc0db121d62fbcc40f1..e72741357d586a683895d0f3903fd74545883520 100644 (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
index 7cad640878f89dca1b0392c781b514f1e7ba4129..c642d47764cad1cfc6999898656c12501d3160ab 100644 (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;
 }
 
This page took 0.037606 seconds and 4 git commands to generate.