[gnome-chess] Engine: do not close pid until source is removed



commit db56f6a257ff7f82eb58fbf3d98611585507082b
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Oct 13 19:03:50 2013 -0500

    Engine: do not close pid until source is removed
    
    "Note that on platforms where GPid must be explicitly closed (see
    g_spawn_close_pid()) pid must not be closed while the source is still
    active."
    
    See 6ed120deb43069cb8ae9ef81ac99ac390b523b96 but do it right this time.
    
    It really doesn't matter because this is Windows-only, and GNOME Chess
    does not run on Windows, but it's nice to be correct.

 src/chess-engine.vala |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
---
diff --git a/src/chess-engine.vala b/src/chess-engine.vala
index 2ed478a..3e83189 100644
--- a/src/chess-engine.vala
+++ b/src/chess-engine.vala
@@ -91,6 +91,7 @@ public abstract class ChessEngine : Object
 
     private void engine_stopped_cb (Pid pid, int status)
     {
+        Process.close_pid (pid);
         stopped ();
     }
 
@@ -108,10 +109,7 @@ public abstract class ChessEngine : Object
             Source.remove (stdout_watch_id);
 
         if (pid != 0)
-        {
-            Process.close_pid (pid);
             Posix.kill (pid, Posix.SIGTERM);
-        }
     }
 
     private bool read_cb (IOChannel source, IOCondition condition)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]