aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2020-04-18 21:46:14 +0200
committerMarc Hoersken <info@marc-hoersken.de>2020-05-02 17:05:26 +0200
commit551577f35791be6b9423e8f606383bc1b8394c46 (patch)
treef6e57189ed79cc3ae4bb6e7217de7f3e2d18efca /tests
parentfe28fcf04cdfe7c6e1ab4499a33f9b8479839f14 (diff)
tests/server/util.c: fix thread handle not being closed
Reviewed-by: Jay Satiro Part of #5260
Diffstat (limited to 'tests')
-rw-r--r--tests/server/util.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/server/util.c b/tests/server/util.c
index 99aa1de40..68889c0dc 100644
--- a/tests/server/util.c
+++ b/tests/server/util.c
@@ -803,8 +803,15 @@ void restore_signal_handlers(bool keep_sigalrm)
#ifdef WIN32
(void)SetConsoleCtrlHandler(ctrl_event_handler, FALSE);
if(thread_main_window && thread_main_id) {
- if(PostThreadMessage(thread_main_id, WM_APP, 0, 0))
- (void)WaitForSingleObjectEx(thread_main_window, INFINITE, TRUE);
+ if(PostThreadMessage(thread_main_id, WM_APP, 0, 0)) {
+ if(WaitForSingleObjectEx(thread_main_window, INFINITE, TRUE)) {
+ if(CloseHandle(thread_main_window)) {
+ thread_main_window = NULL;
+ thread_main_id = 0;
+ }
+ }
+ }
+ }
}
#endif
}