Fix wrapping crash when URL is wider than wrapping margin.
[claws.git] / src / compose.c
index 0d88640a0f63adae94faf304a25db300c34d4070..04f19c3d2a905e3cd1cddb81de5ddbf48e740702 100644 (file)
@@ -2331,6 +2331,11 @@ static void compose_wrap_line_all(Compose *compose)
                                        do_delete = FALSE;
                        }
 
+                       /* skip delete if it is continuous URL */
+                       if (do_delete && (line_pos - p_pos <= i_len) &&
+                           gtkut_stext_is_uri_string(text, line_pos, tlen))
+                               do_delete = FALSE;
+
 #ifdef WRAP_DEBUG
                        printf("qlen=%d l_len=%d wrap_len=%d do_del=%d\n",
                                qlen, line_len, linewrap_len, do_delete);
@@ -4955,6 +4960,12 @@ static void compose_destroy(Compose *compose)
        if (addressbook_get_target_compose() == compose)
                addressbook_set_target_compose(NULL);
 
+#if USE_PSPELL
+        if (compose->gtkpspell) {
+               gtkpspell_delete(compose->gtkpspell);
+        }
+#endif
+
        prefs_common.compose_width = compose->scrolledwin->allocation.width;
        prefs_common.compose_height = compose->window->allocation.height;
 
@@ -5970,11 +5981,6 @@ static void compose_close_cb(gpointer data, guint action, GtkWidget *widget)
                        return;
                }
        }
-#if USE_PSPELL
-        if (compose->gtkpspell) {
-               gtkpspell_delete(compose->gtkpspell);
-        }
-#endif
        gtk_widget_destroy(compose->window);
 }