diff options
author | infirit <[email protected]> | 2014-12-09 15:48:07 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-09 23:02:28 +0100 |
commit | ee9488f9111aa174d6dd3e17c38ad1c76876dd2f (patch) | |
tree | 2c5d2f2ea9a160e4621b71f0187a34859790c5e9 /libview/ev-jobs.c | |
parent | 5abb88d4376fdb478455a6acb9a8d322d51da5ee (diff) | |
download | atril-ee9488f9111aa174d6dd3e17c38ad1c76876dd2f.tar.bz2 atril-ee9488f9111aa174d6dd3e17c38ad1c76876dd2f.tar.xz |
libview: make sure cancellable object is always cancelled in ev_job_cancel()
It's safe to call it multiple times, and we still don't emit our
cancelled signal for finished jobs.
Taken from evince commit: 87084fb2aabc726343f6515c09ac6d2bba42afb1
From: Carlos Garcia Campos <[email protected]>
Diffstat (limited to 'libview/ev-jobs.c')
-rw-r--r-- | libview/ev-jobs.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c index de6a7182..84ab83ae 100644 --- a/libview/ev-jobs.c +++ b/libview/ev-jobs.c @@ -231,7 +231,7 @@ ev_job_run (EvJob *job) void ev_job_cancel (EvJob *job) { - if (job->cancelled || (job->finished && job->idle_finished_id == 0)) + if (job->cancelled) return; ev_debug_message (DEBUG_JOBS, "job %s (%p) cancelled", EV_GET_TYPE_NAME (job), job); @@ -240,6 +240,10 @@ ev_job_cancel (EvJob *job) /* This should never be called from a thread */ job->cancelled = TRUE; g_cancellable_cancel (job->cancellable); + + if (job->finished && job->idle_finished_id == 0) + return; + g_signal_emit (job, job_signals[CANCELLED], 0); } |