From 403b48fc6b2f525b6d9d470c66d7c7d9e48a1239 Mon Sep 17 00:00:00 2001 From: Takashi Yano via Cygwin-patches Date: Thu, 27 Aug 2020 18:46:20 +0900 Subject: [PATCH] Cygwin: select: Fix a bug on closing pi->bye event. - Close event handle pi->bye only if it was created. Addresses: https://cygwin.com/pipermail/cygwin-developers/2020-August/011948.html --- winsup/cygwin/select.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 9f1a8a57a..501714fa7 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -783,8 +783,8 @@ pipe_cleanup (select_record *, select_stuff *stuff) pi->stop_thread = true; SetEvent (pi->bye); pi->thread->detach (); + CloseHandle (pi->bye); } - CloseHandle (pi->bye); delete pi; stuff->device_specific_pipe = NULL; } @@ -978,8 +978,8 @@ fifo_cleanup (select_record *, select_stuff *stuff) pi->stop_thread = true; SetEvent (pi->bye); pi->thread->detach (); + CloseHandle (pi->bye); } - CloseHandle (pi->bye); delete pi; stuff->device_specific_fifo = NULL; } @@ -1344,8 +1344,8 @@ pty_slave_cleanup (select_record *me, select_stuff *stuff) pi->stop_thread = true; SetEvent (pi->bye); pi->thread->detach (); + CloseHandle (pi->bye); } - CloseHandle (pi->bye); delete pi; stuff->device_specific_ptys = NULL; }