2007-04-24 [wwp] 2.9.1cvs19
authorTristan Chabredier <wwp@claws-mail.org>
Tue, 24 Apr 2007 10:05:01 +0000 (10:05 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Tue, 24 Apr 2007 10:05:01 +0000 (10:05 +0000)
* src/textview.c
* src/textview.h
Fix a crash in textview, thanks to Colin.

ChangeLog
PATCHSETS
configure.ac
src/textview.c
src/textview.h

index 8ebfec3d6b877265798551632f5ed71115f3f994..3ca1f92fc90272cb087f965820a17f8e3b2e3af5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-04-24 [wwp]       2.9.1cvs19
+
+       * src/textview.c
+       * src/textview.h
+               Fix a crash in textview, thanks to Colin.
+
 2007-04-23 [wwp]       2.9.1cvs18
 
        * src/prefs_common.c
index 8d28625de7e5e0a08655a2707b3d0b676a8a0676..effb781b5e153bb8b920757bce08e4fb8b5e9aff 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.155.2.61 -r 1.155.2.62 src/Makefile.am;  cvs diff -u -r 1.25.2.36 -r 1.25.2.37 src/stock_pixmap.c;  cvs diff -u -r 1.18.2.25 -r 1.18.2.26 src/stock_pixmap.h;  cvs diff -u -r 1.395.2.298 -r 1.395.2.299 src/summaryview.c;  cvs diff -u -r 1.68.2.36 -r 1.68.2.37 src/summaryview.h;  cvs diff -u -r 1.1.4.38 -r 1.1.4.39 src/gtk/gtksctree.c;  cvs diff -u -r 1.1.4.10 -r 1.1.4.11 src/gtk/gtksctree.h;  diff -u /dev/null src/pixmaps/selection.xpm;  ) > 2.9.1cvs16.patchset
 ( cvs diff -u -r 1.155.2.61 -r 1.155.2.62 src/Makefile.am;  cvs diff -u -r 1.25.2.36 -r 1.25.2.37 src/stock_pixmap.c;  cvs diff -u -r 1.18.2.25 -r 1.18.2.26 src/stock_pixmap.h;  cvs diff -u -r 1.395.2.298 -r 1.395.2.299 src/summaryview.c;  cvs diff -u -r 1.68.2.36 -r 1.68.2.37 src/summaryview.h;  cvs diff -u -r 1.1.4.38 -r 1.1.4.39 src/gtk/gtksctree.c;  cvs diff -u -r 1.1.4.10 -r 1.1.4.11 src/gtk/gtksctree.h;  diff -u /dev/null src/pixmaps/selection.xpm;  ) > 2.9.1cvs17.patchset
 ( cvs diff -u -r 1.204.2.131 -r 1.204.2.132 src/prefs_common.c;  ) > 2.9.1cvs18.patchset
+( cvs diff -u -r 1.96.2.169 -r 1.96.2.170 src/textview.c;  cvs diff -u -r 1.12.2.18 -r 1.12.2.19 src/textview.h;  ) > 2.9.1cvs19.patchset
index f6d071388206babf7ae05e367a1085dc72b64136..a77dfb4f261e8c0d662a3ed6a941c6a6a38eeb22 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=18
+EXTRA_VERSION=19
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 6ed41573345ea63f75f7a34dac7afc944dab2ba0..79772e2653e0681b1e54b1a93b7e951edbcccf84 100644 (file)
@@ -69,8 +69,6 @@
 #include "inputdialog.h"
 #include "timing.h"
 
-gint previousquotelevel = -1;
-
 static GdkColor quote_colors[3] = {
        {(gulong)0, (gushort)0, (gushort)0, (gushort)0},
        {(gulong)0, (gushort)0, (gushort)0, (gushort)0},
@@ -609,7 +607,7 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo)
                return;
        }
 
-       previousquotelevel = -1;
+       textview->prev_quote_level = -1;
 
        if ((mimeinfo->type == MIMETYPE_MESSAGE) && !g_ascii_strcasecmp(mimeinfo->subtype, "rfc822")) {
                FILE *fp;
@@ -1408,7 +1406,7 @@ static void textview_write_line(TextView *textview, const gchar *str,
                        g_free(utf8buf);
                }
 do_quote:
-               if ( previousquotelevel != real_quotelevel ) {
+               if ( textview->prev_quote_level != real_quotelevel ) {
                        ClickableText *uri;
                        uri = g_new0(ClickableText, 1);
                        uri->uri = g_strdup("");
@@ -1428,14 +1426,20 @@ do_quote:
                        textview->uri_list =
                                g_slist_prepend(textview->uri_list, uri);
                
-                       previousquotelevel = real_quotelevel;
+                       textview->prev_quote_level = real_quotelevel;
                } else {
                        GSList *last = textview->uri_list;
-                       ClickableText *lasturi = (ClickableText *)last->data;
+                       ClickableText *lasturi = NULL;
                        gint e_len = 0, n_len = 0;
                        
+                       if (textview->uri_list) {
+                               lasturi = (ClickableText *)last->data;
+                       } else {
+                               printf("oops (%d %d)\n",
+                                       real_quotelevel, textview->prev_quote_level);
+                       }               
                        if (lasturi->is_quote == FALSE) {
-                               previousquotelevel = -1;
+                               textview->prev_quote_level = -1;
                                goto do_quote;
                        }
                        e_len = lasturi->data ? strlen(lasturi->data):0;
@@ -1446,7 +1450,7 @@ do_quote:
                }
        } else {
                textview_make_clickable_parts(textview, fg_color, "link", buf, FALSE);
-               previousquotelevel = -1;
+               textview->prev_quote_level = -1;
        }
 }
 
@@ -1526,6 +1530,7 @@ void textview_clear(TextView *textview)
        textview_uri_list_remove_all(textview->uri_list);
        textview->uri_list = NULL;
        textview->uri_hover = NULL;
+       textview->prev_quote_level = -1;
 
        textview->body_pos = 0;
        if (textview->image) 
@@ -1550,6 +1555,7 @@ void textview_destroy(TextView *textview)
 
        textview_uri_list_remove_all(textview->uri_list);
        textview->uri_list = NULL;
+       textview->prev_quote_level = -1;
 
        g_free(textview);
 }
index 50021e50b4830e37d27b17fcc16b58720eb8e3f2..e8ed572c85fb9ad2a8c0946ac782b7f8fd93fd33 100644 (file)
@@ -81,6 +81,7 @@ struct _TextView
        GtkWidget *image;
        gboolean loading;
        gboolean stop_loading;
+       gint prev_quote_level;
 };
 
 TextView *textview_create              (void);