[gnome-chess] Never try to kill the engine if it is already dead



commit d2f27a16c1dc57e5db83f2c3b57e4669f93f4495
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Feb 2 10:03:46 2014 -0600

    Never try to kill the engine if it is already dead
    
    Currently we attempt to kill the engine immediately after we detect it
    has stopped.

 src/chess-engine.vala |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/chess-engine.vala b/src/chess-engine.vala
index 9474296..34b3115 100644
--- a/src/chess-engine.vala
+++ b/src/chess-engine.vala
@@ -100,6 +100,7 @@ public abstract class ChessEngine : Object
     private void engine_stopped_cb (Pid pid, int status)
     {
         Process.close_pid (pid);
+        pid = 0;
         stopped ();
     }
 
@@ -135,7 +136,7 @@ public abstract class ChessEngine : Object
             warning ("Failed to close pipe to engine's stderr: %s",
                      strerror (errno));
 
-        if (Posix.kill (pid, Posix.SIGTERM) == -1)
+        if (pid != 0 && Posix.kill (pid, Posix.SIGTERM) == -1)
             warning ("Failed to kill engine: %s", strerror (errno));
 
         started = false;


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