Increase reference in zathura_page_widget_update_surface

and always destroy in render.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2013-07-27 01:34:42 +02:00
parent c6140296cd
commit f98514d5ed
2 changed files with 5 additions and 3 deletions

View file

@ -505,11 +505,13 @@ zathura_page_widget_update_surface(ZathuraPage* widget, cairo_surface_t* surface
zathura_page_widget_private_t* priv = ZATHURA_PAGE_GET_PRIVATE(widget);
mutex_lock(&(priv->lock));
if (priv->surface != NULL) {
cairo_surface_finish(priv->surface);
cairo_surface_destroy(priv->surface);
}
priv->render_requested = false;
priv->surface = surface;
if (priv->surface != NULL) {
cairo_surface_reference(surface);
}
mutex_unlock(&(priv->lock));
/* force a redraw here */
if (priv->surface != NULL) {

View file

@ -266,10 +266,10 @@ render(zathura_t* zathura, zathura_page_t* page)
GtkWidget* widget = zathura_page_get_widget(zathura, page);
zathura_page_widget_update_surface(ZATHURA_PAGE(widget), surface);
gdk_threads_leave();
} else {
cairo_surface_destroy(surface);
}
cairo_surface_destroy(surface);
return true;
}