[gnome-chess/gnome-3-10] Fix critical warnings when starting a new game



commit 24a659ee8272c80f825fc31e318a3facf29e84f7
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Jan 7 20:24:37 2014 -0600

    Fix critical warnings when starting a new game
    
    Never try to remove the same source twice

 src/chess-engine.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/chess-engine.vala b/src/chess-engine.vala
index 9e7b084..8dee767 100644
--- a/src/chess-engine.vala
+++ b/src/chess-engine.vala
@@ -105,7 +105,10 @@ public abstract class ChessEngine : Object
     public void stop ()
     {
         if (stdout_watch_id > 0)
+        {
             Source.remove (stdout_watch_id);
+            stdout_watch_id = 0;
+        }
 
         if (pid != 0)
         {
@@ -127,16 +130,19 @@ public abstract class ChessEngine : Object
         }
         catch (ConvertError e)
         {
+            stdout_watch_id = 0;
             return false;
         }
         catch (IOChannelError e)
         {
+            stdout_watch_id = 0;
             return false;
         }
 
         if (status == IOStatus.EOF)
         {
             stdout.printf ("EOF\n");
+            stdout_watch_id = 0;
             return false;
         }
         if (status == IOStatus.NORMAL)


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