You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2019/06/11 09:32:14 UTC

[commons-daemon] branch master updated: Fix https://issues.apache.org/jira/browse/DAEMON-402

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git


The following commit(s) were added to refs/heads/master by this push:
     new b8caa52  Fix https://issues.apache.org/jira/browse/DAEMON-402
b8caa52 is described below

commit b8caa5295a2d1e482fb443de2acec949b448152b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jun 11 10:30:35 2019 +0100

    Fix https://issues.apache.org/jira/browse/DAEMON-402
    
    Avoid a crash on shutdown if multiple WM_CLOSE messages are received.
    Patch provided by Iode Leroy
---
 src/changes/changes.xml           | 4 ++++
 src/native/windows/src/rprocess.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5dff7f2..2fafd97 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -104,6 +104,10 @@
         Procrun. Change the default service user from LocalSystem to
         'NT Authority\LocalService'.
       </action>
+      <action issue="DAEMON-402" yype="fix" dev="markt" due-to="Iode Leroy">
+        Procrun. Avoid a crash on shutdown if multiple WM_CLOSE messages are
+        received.
+      </action>
     </release>
     <release version="1.1.0" date="2017-11-15" description="Feature and bug fix release">
       <action issue="DAEMON-368" type="add" dev="ggregory">
diff --git a/src/native/windows/src/rprocess.c b/src/native/windows/src/rprocess.c
index 1b58bfe..727ff18 100644
--- a/src/native/windows/src/rprocess.c
+++ b/src/native/windows/src/rprocess.c
@@ -376,6 +376,8 @@ static BOOL __apxProcessCallback(APXHANDLE hObject, UINT uMsg,
         (*lpProc->fnUserCallback)(hObject, uMsg, wParam, lParam);
     switch (uMsg) {
         case WM_CLOSE:
+        	/* Avoid processing the WM_CLOSE message multiple times */
+        	if (lpProc->stProcInfo.hProcess == NULL) break;
             if (lpProc->dwChildStatus & CHILD_RUNNING) {
                 __apxProcessClose(hObject);
                 /* Wait for all worker threads to exit */