From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 0B9BF393C860; Fri, 28 Aug 2020 13:25:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B9BF393C860 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: select: Fix a bug on closing pi->bye event. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano via Cygwin-patches X-Git-Refname: refs/heads/master X-Git-Oldrev: 7c963c7ba030b9e110eefd6412eff4d6189f29e7 X-Git-Newrev: c8b076a23361fa9ebaec09d01253043ca2948f24 Message-Id: <20200828132503.0B9BF393C860@sourceware.org> Date: Fri, 28 Aug 2020 13:25:03 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 13:25:03 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c8b076a23361fa9ebaec09d01253043ca2948f24 commit c8b076a23361fa9ebaec09d01253043ca2948f24 Author: Takashi Yano via Cygwin-patches Date: Thu Aug 27 18:46:20 2020 +0900 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 Diff: --- 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; }