[Commits] [SCM] claws branch, master, updated. 3.17.4-63-g844944f10
colin at claws-mail.org
colin at claws-mail.org
Sat Nov 9 22:14:25 CET 2019
The branch, master has been updated
via 844944f102a6a295b818eca8bf6e8e7a2f2e0f92 (commit)
from 5286b61fa85f46ed353f68c65af30a187cbabaa1 (commit)
Summary of changes:
src/messageview.c | 14 +++++++++++---
src/printing.c | 16 +++++++++-------
2 files changed, 20 insertions(+), 10 deletions(-)
- Log -----------------------------------------------------------------
commit 844944f102a6a295b818eca8bf6e8e7a2f2e0f92
Author: Colin Leroy <colin at colino.net>
Date: Sat Nov 9 23:13:33 2019 +0100
Printing: only print as plain text if the part is of type text;
fix a segfault with default info icon when trying to print a non-text
part.
diff --git a/src/messageview.c b/src/messageview.c
index b4fc18316..3a6184f98 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -2181,9 +2181,17 @@ static void print_mimeview(MimeView *mimeview, gint sel_start, gint sel_end, gin
viewer->print(viewer);
return;
} else {
- /* Force text rendering */
- mimeview_show_part_as_text(mimeview,
- mimeview_get_selected_part(mimeview));
+ /* Force text rendering if possible */
+ MimeInfo *mimepart;
+
+ mimepart = mimeview_get_selected_part(mimeview);
+ if (mimepart == NULL
+ || (mimepart->type != MIMETYPE_TEXT && mimepart->type != MIMETYPE_MESSAGE)) {
+ alertpanel_warning(_("Cannot print: the message doesn't "
+ "contain text."));
+ return;
+ }
+ mimeview_show_part_as_text(mimeview, mimepart);
}
}
if (sel_start != -1 && sel_end != -1) {
diff --git a/src/printing.c b/src/printing.c
index ae3cd15ef..d0d3d97ef 100644
--- a/src/printing.c
+++ b/src/printing.c
@@ -1122,16 +1122,18 @@ static void printing_textview_cb_draw_page(GtkPrintOperation *op, GtkPrintContex
GdkPixbuf *pixbuf = gtk_image_get_pixbuf(print_data->avatar);
gdouble startx, starty;
- startx = gtk_print_context_get_width(context)/print_data->zoom;
+ if (pixbuf != NULL) {
+ startx = gtk_print_context_get_width(context)/print_data->zoom;
- startx -= ((double)gdk_pixbuf_get_width(pixbuf));
+ startx -= ((double)gdk_pixbuf_get_width(pixbuf));
- starty = start_pos;
+ starty = start_pos;
- surface = pixbuf_to_surface(pixbuf);
- cairo_set_source_surface (cr, surface, startx, starty);
- cairo_paint (cr);
- cairo_surface_destroy (surface);
+ surface = pixbuf_to_surface(pixbuf);
+ cairo_set_source_surface (cr, surface, startx, starty);
+ cairo_paint (cr);
+ cairo_surface_destroy (surface);
+ }
}
pango_layout_iter_free(iter);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list