fix crash when performing an action on a mime part
authorPaul Mangan <paul@claws-mail.org>
Mon, 28 Apr 2003 12:53:42 +0000 (12:53 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 28 Apr 2003 12:53:42 +0000 (12:53 +0000)
ChangeLog.claws
configure.ac
src/action.c

index 7086091..ede7b46 100644 (file)
@@ -1,3 +1,9 @@
+2003-04-28 [paul]      0.8.11claws121
+
+       * src/action.c
+               a better fix for the crash when performing an action
+               on a mime part
+
 2003-04-28 [paul]      0.8.11claws120
 
        * src/action.c
index 77f9fbb..b4d25a2 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws120
+EXTRA_VERSION=claws121
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index b9611fe..62ee656 100644 (file)
@@ -588,32 +588,34 @@ static gboolean execute_actions(gchar *action, GSList *msg_list,
        }
 
        if (text) {
-               start = GTK_EDITABLE(text)->selection_start_pos;
-               end   = GTK_EDITABLE(text)->selection_end_pos;
-               if (start > end) {
-                       guint tmp;
-                       tmp = start;
-                       start = end;
-                       end = tmp;
-               }
+               if (GTK_EDITABLE(text)->has_selection) {
+                       start = GTK_EDITABLE(text)->selection_start_pos;
+                       end   = GTK_EDITABLE(text)->selection_end_pos;
+                       if (start > end) {
+                               guint tmp;
+                               tmp = start;
+                               start = end;
+                               end = tmp;
+                       }
 
-               if (start == end) {
+                       if (start == end) {
+                               start = body_pos;
+                               end = gtk_stext_get_length(GTK_STEXT(text));
+                               msg_str = gtk_editable_get_chars(GTK_EDITABLE(text),
+                                                        start, end);
+                       } else {
+                               sel_str = gtk_editable_get_chars(GTK_EDITABLE(text),
+                                                                start, end);
+                       msg_str = g_strdup(sel_str);
+                       }
+               }  else {
                        start = body_pos;
                        end = gtk_stext_get_length(GTK_STEXT(text));
                        msg_str = gtk_editable_get_chars(GTK_EDITABLE(text),
-                                                        start, end);
-               } else {
-                       sel_str = gtk_editable_get_chars(GTK_EDITABLE(text),
-                                                        start, end);
-                       msg_str = g_strdup(sel_str);
-               }
-       } else {
-               start = body_pos;
-               end = gtk_stext_get_length(GTK_STEXT(text));
-               msg_str = gtk_editable_get_chars(GTK_EDITABLE(text),
                                                 start, end);
+               } 
        }
-
+       
        if (action_type & ACTION_USER_STR) {
                if (!(user_str = get_user_string(action, ACTION_USER_STR))) {
                        g_free(msg_str);