talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 373df07cd25c3a278177a9441fc2b502341901e0
parent dfb828b75a5b50c665f1cfeccdb281475b1275c4
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Tue, 29 Jan 2019 21:47:53 +0100

Properly free previous document from memory in litehtml's clear()

We also call paint_white() earlier in redraw().
This results in properly clearing the previously
rendered html content when opening a different
HTML part.

Diffstat:
Msrc/plugins/litehtml_viewer/lh_widget.cpp | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp @@ -240,10 +240,10 @@ void lh_widget::redraw() GdkWindow *gdkwin; cairo_t *cr; - if (m_html == NULL) { - g_warning("lh_widget::redraw: No document!"); + paint_white(); + + if (m_html == NULL) return; - } /* Get width of the viewport. */ gdkwin = gtk_viewport_get_view_window(GTK_VIEWPORT(m_viewport)); @@ -269,8 +269,6 @@ void lh_widget::redraw() m_html->width(), m_html->height()); } - paint_white(); - /* Paint the rendered HTML. */ gdkwin = gtk_widget_get_window(m_drawing_area); if (gdkwin == NULL) { @@ -303,6 +301,7 @@ void lh_widget::paint_white() } void lh_widget::clear() { + m_html = nullptr; paint_white(); m_rendered_width = 0; }