foxygit / doom Log in
commit 1680a64e775713478597248e5ecdf90aa1ef33ee
Author:     Alex Mayfield <alexmax2742@gmail.com>
AuthorDate: Tue Feb 21 22:29:25 2017 -0500
Commit:     Alex Mayfield <alexmax2742@gmail.com>
CommitDate: Tue Feb 21 22:29:25 2017 -0500

    Close client copies of inherited handles

    This ensures that if the server dies, attempts to write to the server
    pipe will return an error, instead of writing into oblivion and an
    eventual deadlock when the pipe buffer fills up.
---
 src/i_midipipe.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/i_midipipe.c b/src/i_midipipe.c
index 2a6b8a2e..c0d21409 100644
--- a/src/i_midipipe.c
+++ b/src/i_midipipe.c
@@ -440,6 +440,12 @@ boolean I_MidiPipe_InitServer()
         goto fail;
     }

+    // Since the server has these handles, we don't need them anymore.
+    CloseHandle(midi_process_in_reader);
+    midi_process_in_reader = NULL;
+    CloseHandle(midi_process_out_writer);
+    midi_process_out_writer = NULL;
+
     midi_server_initialized = true;
     return true;