Improve synchronous action exit code (fixes long delay after action exit on RH9
authorMelvin Hadasht <melvin.hadasht@free.fr>
Fri, 5 Sep 2003 08:49:13 +0000 (08:49 +0000)
committerMelvin Hadasht <melvin.hadasht@free.fr>
Fri, 5 Sep 2003 08:49:13 +0000 (08:49 +0000)
ChangeLog.claws
configure.ac
src/action.c

index 03eafb5..aa06fdb 100644 (file)
@@ -1,3 +1,9 @@
+2003-09-03 [melvin]    0.9.4claws61
+
+       * src/action.c
+               Improve synchronous action exit code (fixes 
+               a ~5 seconds delay after action exit on RedHat 9)
+
 2003-09-03 [christoph] 0.9.4claws61
 
        * src/compose.c
index 2f4f72a..8dcd569 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=61
+EXTRA_VERSION=62
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index bf5d347..fc5bc80 100644 (file)
@@ -958,15 +958,25 @@ static gint io_dialog_key_pressed_cb(GtkWidget *widget, GdkEventKey *event,
 
 static void childinfo_close_pipes(ChildInfo *child_info)
 {
+       /* stdout and stderr pipes are guaranteed to be removed by
+        * their handler, but in case where we receive child exit notification
+        * before grand-child's pipes closing signals, we check them and close
+        * them if necessary
+        */
        if (child_info->tag_in > 0)
                gdk_input_remove(child_info->tag_in);
-       gdk_input_remove(child_info->tag_out);
-       gdk_input_remove(child_info->tag_err);
+       if (child_info->tag_out > 0)
+               gdk_input_remove(child_info->tag_out);
+       if (child_info->tag_err > 0)
+               gdk_input_remove(child_info->tag_err);
 
        if (child_info->chld_in >= 0)
                close(child_info->chld_in);
-       close(child_info->chld_out);
-       close(child_info->chld_err);
+       if (child_info->chld_out >= 0)
+               close(child_info->chld_out);
+       if (child_info->chld_err >= 0)
+               close(child_info->chld_err);
+
        close(child_info->chld_status);
 }
 
@@ -1260,6 +1270,20 @@ static void catch_output(gpointer data, gint source, GdkInputCondition cond)
                if (c > 0)
                        child_info->new_out = TRUE;
        }
+       if (c == 0) {
+               if (source == child_info->chld_out) {
+                       gdk_input_remove(child_info->tag_out);
+                       child_info->tag_out = -1;
+                       close(child_info->chld_out);
+                       child_info->chld_out = -1;
+               } else {
+                       gdk_input_remove(child_info->tag_err);
+                       child_info->tag_err = -1;
+                       close(child_info->chld_err);
+                       child_info->chld_err = -1;
+               }
+       }
+       
        wait_for_children(child_info->children);
 }