summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-12-30 20:24:44 +0100
committerraveit65 <[email protected]>2021-01-07 20:37:14 +0100
commit21dfebaac3f2edfb0805b61de950859e36b53289 (patch)
tree1f1ccd0c62f9529c48f225be35e61ec6369b33f5
parenta3173f89e2cbec52df8e17d158b4a9be4d88c8b3 (diff)
downloadatril-21dfebaac3f2edfb0805b61de950859e36b53289.tar.bz2
atril-21dfebaac3f2edfb0805b61de950859e36b53289.tar.xz
Check whether the document page failed to render
-rw-r--r--libview/ev-jobs.c13
-rw-r--r--libview/ev-pixbuf-cache.c6
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);
}