Blob Blame History Raw
From dd77d7b6471c12a3654ea3745bf3d639dba1b3ce Mon Sep 17 00:00:00 2001
From: Kouhei Sutou <kou@clear-code.com>
Date: Thu, 15 Jan 2015 21:55:02 +0900
Subject: [PATCH 4/4] gcut egg: fix a bug that timeout source is removed twice

Signed-off-by: HAYASHI Kentaro <kenhys@gmail.com>
---
 gcutter/gcut-egg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcutter/gcut-egg.c b/gcutter/gcut-egg.c
index f4f0101..ac5c414 100644
--- a/gcutter/gcut-egg.c
+++ b/gcutter/gcut-egg.c
@@ -342,7 +342,8 @@ dispose (GObject *object)
                                             &is_timeout);
             while (!is_timeout && priv->process_watch_id > 0 && priv->pid > 0)
                 g_main_context_iteration(NULL, TRUE);
-            g_source_remove(timeout_wait_id);
+            if (!is_timeout)
+                g_source_remove(timeout_wait_id);
         }
     }
 
@@ -874,7 +875,8 @@ gcut_egg_wait (GCutEgg *egg, guint timeout, GError **error)
     timeout_id = g_timeout_add(timeout, cb_timeout_wait, &is_timeout);
     while (!is_timeout && priv->pid > 0)
         g_main_context_iteration(NULL, TRUE);
-    g_source_remove(timeout_id);
+    if (!is_timeout)
+        g_source_remove(timeout_id);
 
     if (is_timeout) {
         gchar *command;
-- 
2.1.0