[Xfce4-commits] <postler:master> Close IO channels of helper processes when done

Christian Dywan noreply at xfce.org
Wed Mar 30 22:38:03 CEST 2011


Updating branch refs/heads/master
         to 634d8cb3dab1cd79da734e4210eb968491001ff4 (commit)
       from 0807af2df5de437942e1ad5c5789973dd9a6aa3b (commit)

commit 634d8cb3dab1cd79da734e4210eb968491001ff4
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Mar 30 22:27:59 2011 +0200

    Close IO channels of helper processes when done

 postler/postler-service.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/postler/postler-service.vala b/postler/postler-service.vala
index d551cef..efafa40 100644
--- a/postler/postler-service.vala
+++ b/postler/postler-service.vala
@@ -39,8 +39,10 @@ namespace Postler {
                     SpawnFlags.SEARCH_PATH,
                     null, out pid, null, out out_fd, out err_fd);
                 inputc = new IOChannel.unix_new (out_fd);
+                inputc.set_close_on_unref (true);
                 inputc.add_watch_full (0, IOCondition.IN | IOCondition.HUP, input_callback);
                 errorc = new IOChannel.unix_new (err_fd);
+                errorc.set_close_on_unref (true);
                 errorc.add_watch_full (0, IOCondition.IN | IOCondition.HUP, input_callback);
             }
             catch (GLib.Error error) {
@@ -56,6 +58,12 @@ namespace Postler {
             if ((condition & IOCondition.HUP) == IOCondition.HUP) {
                 GLib.debug ("Done/ %s: %s",
                             channel == errorc ? "error" : "input", command);
+                if (channel == inputc)
+                    inputc = null;
+                else if (channel == errorc)
+                    errorc = null;
+                else
+                    assert_not_reached ();
                 done ();
                 return false;
             }
@@ -83,6 +91,7 @@ namespace Postler {
 
         internal void finnish (string error_message="") {
             command = null;
+            inputc = errorc = null;
             done (error_message);
         }
 



More information about the Xfce4-commits mailing list