2011-04-08 [colin] 3.7.8cvs76
authorColin Leroy <colin@colino.net>
Fri, 8 Apr 2011 19:18:26 +0000 (19:18 +0000)
committerColin Leroy <colin@colino.net>
Fri, 8 Apr 2011 19:18:26 +0000 (19:18 +0000)
* src/action.c
Fix action Stop: if child does not react to SIGTERM, it'll
probably start behaving when it'll get a SIGKILL on the user's
second press on Stop.
Fixes bug #2237, "User action makes Claws unresponsive".

ChangeLog
PATCHSETS
configure.ac
src/action.c

index 0867873..0c23e5c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-04-08 [colin]     3.7.8cvs76
+
+       * src/action.c
+               Fix action Stop: if child does not react to SIGTERM, it'll
+               probably start behaving when it'll get a SIGKILL on the user's
+               second press on Stop.
+               Fixes bug #2237, "User action makes Claws unresponsive".
+
 2011-04-08 [colin]     3.7.8cvs75
 
        * src/account.c
index 17b1ff8..df02d37 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.2.2.42 -r 1.2.2.43 src/gtk/filesel.c;  ) > 3.7.8cvs73.patchset
 ( cvs diff -u -r 1.49.2.139 -r 1.49.2.140 src/procmime.c;  ) > 3.7.8cvs74.patchset
 ( cvs diff -u -r 1.61.2.96 -r 1.61.2.97 src/account.c;  cvs diff -u -r 1.213.2.200 -r 1.213.2.201 src/folder.c;  cvs diff -u -r 1.87.2.63 -r 1.87.2.64 src/folder.h;  cvs diff -u -r 1.2.2.36 -r 1.2.2.37 src/folder_item_prefs.c;  cvs diff -u -r 1.2.2.23 -r 1.2.2.24 src/folder_item_prefs.h;  cvs diff -u -r 1.105.2.165 -r 1.105.2.166 src/prefs_account.c;  ) > 3.7.8cvs75.patchset
+( cvs diff -u -r 1.12.2.64 -r 1.12.2.65 src/action.c;  ) > 3.7.8cvs76.patchset
index 32e6c65..8174895 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=75
+EXTRA_VERSION=76
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 939dcdb..0bd1db7 100644 (file)
@@ -89,6 +89,7 @@ struct _ChildInfo
        Children        *children;
        gchar           *cmd;
        pid_t            pid;
+       gint             next_sig;
        gint             chld_in;
        gint             chld_out;
        gint             chld_err;
@@ -951,10 +952,6 @@ static ChildInfo *fork_child(gchar *cmd, const gchar *msg_str,
                if (setpgid(0, 0))
                        perror("setpgid");
 
-#ifdef GDK_WINDOWING_X11
-               r = close(ConnectionNumber(gdk_display_get_default()));
-#endif /* GDK_WINDOWING_X11 */
-
                gch_pid = fork();
 
                if (gch_pid == 0) {
@@ -967,18 +964,18 @@ static ChildInfo *fork_child(gchar *cmd, const gchar *msg_str,
                                     ACTION_USER_IN |
                                     ACTION_USER_HIDDEN_IN)) {
                                        r |= close(fileno(stdin));
-                                       r |= dup  (chld_in[0]);
+                                       (void) dup  (chld_in[0]);
                                }
                                r |= close(chld_in[0]);
                                r |= close(chld_in[1]);
 
                                r |= close(fileno(stdout));
-                               r |= dup  (chld_out[1]);
+                               (void) dup  (chld_out[1]);
                                r |= close(chld_out[0]);
                                r |= close(chld_out[1]);
 
                                r |= close(fileno(stderr));
-                               r |= dup  (chld_err[1]); /* why does that fail ? */
+                               (void) dup  (chld_err[1]);
                                r |= close(chld_err[0]);
                                r |= close(chld_err[1]);
 
@@ -1056,6 +1053,7 @@ static ChildInfo *fork_child(gchar *cmd, const gchar *msg_str,
        child_info->children    = children;
 
        child_info->pid         = pid;
+       child_info->next_sig    = SIGTERM;
        child_info->cmd         = g_strdup(cmd);
        child_info->new_out     = FALSE;
        child_info->output      = g_string_new(NULL);
@@ -1109,8 +1107,9 @@ static void kill_children_cb(GtkWidget *widget, gpointer data)
        for (cur = children->list; cur; cur = cur->next) {
                child_info = (ChildInfo *)(cur->data);
                debug_print("Killing child group id %d\n", child_info->pid);
-               if (child_info->pid && kill(-child_info->pid, SIGTERM) < 0)
+               if (child_info->pid && kill(-child_info->pid, child_info->next_sig) < 0)
                        perror("kill");
+               child_info->next_sig = SIGKILL;
        }
 #endif /* G_OS_UNIX */
 }