diff --git a/page-widget.c b/page-widget.c index 0c95624..75694a6 100644 --- a/page-widget.c +++ b/page-widget.c @@ -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) { diff --git a/render.c b/render.c index b2ad38b..e8bcde3 100644 --- a/render.c +++ b/render.c @@ -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; }