+2012-12-21 Eli Zaretskii <eliz@gnu.org>
+
+ * w32proc.c (new_child, delete_child, find_child_pid): For a
+ subprocess, consider its slot being in use as long as its process
+ handle (procinfo.hProcess) is not NULL. This avoids reusing the
+ slot when a new process is started immediately after killing
+ another one, without waiting enough time for the first process to
+ be reaped and resources allocated for it be orderly freed.
+ (Bug#13086)
+ Suggested by Fabrice Popineau <fabrice.popineau@supelec.fr>.
+
2012-12-21 Chong Yidong <cyd@gnu.org>
* buffer.c (Fset_buffer_major_mode): Doc fix (Bug#13231).
DWORD id;
for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
- if (!CHILD_ACTIVE (cp))
+ if (!CHILD_ACTIVE (cp) && cp->procinfo.hProcess == NULL)
goto Initialize;
if (child_proc_count == MAX_CHILDREN)
return NULL;
if (fd_info[i].cp == cp)
emacs_abort ();
- if (!CHILD_ACTIVE (cp))
+ if (!CHILD_ACTIVE (cp) && cp->procinfo.hProcess == NULL)
return;
/* reap thread if necessary */
if (cp == child_procs + child_proc_count - 1)
{
for (i = child_proc_count-1; i >= 0; i--)
- if (CHILD_ACTIVE (&child_procs[i]))
+ if (CHILD_ACTIVE (&child_procs[i])
+ || child_procs[i].procinfo.hProcess != NULL)
{
child_proc_count = i + 1;
break;
child_process *cp;
for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
- if (CHILD_ACTIVE (cp) && pid == cp->pid)
+ if ((CHILD_ACTIVE (cp) || cp->procinfo.hProcess != NULL)
+ && pid == cp->pid)
return cp;
return NULL;
}