diff options
-rw-r--r-- | libview/ev-jobs.c | 13 | ||||
-rw-r--r-- | libview/ev-pixbuf-cache.c | 6 |
2 files changed, 18 insertions, 1 deletions
diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c index dca41a9a..5db40cab 100644 --- a/libview/ev-jobs.c +++ b/libview/ev-jobs.c @@ -612,7 +612,18 @@ ev_job_render_run (EvJob *job) rc = ev_render_context_new (ev_page, job_render->rotation, job_render->scale); g_object_unref (ev_page); - job_render->surface = ev_document_render (job->document, rc); + if ((job_render->surface = ev_document_render (job->document, rc)) == NULL) { + ev_document_fc_mutex_unlock (); + ev_document_doc_mutex_unlock (); + g_object_unref (rc); + ev_job_failed (job, + EV_DOCUMENT_ERROR, + EV_DOCUMENT_ERROR_INVALID, + _("Failed to render page %d"), + job_render->page); + return FALSE; + } + /* If job was cancelled during the page rendering, * we return now, so that the thread is finished ASAP */ diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c index 46031d7e..3c034343 100644 --- a/libview/ev-pixbuf-cache.c +++ b/libview/ev-pixbuf-cache.c @@ -327,6 +327,12 @@ job_finished_cb (EvJob *job, job_info = find_job_cache (pixbuf_cache, job_render->page); + if (ev_job_is_failed (job)) { + job_info->job = NULL; + g_object_unref (job); + return; + } + copy_job_to_job_info (job_render, job_info, pixbuf_cache); g_signal_emit (pixbuf_cache, signals[JOB_FINISHED], 0, job_info->region); } |