From: Carlos Garcia Campos Date: Sat, 4 Dec 2010 14:46:52 +0000 (+0100) Subject: libview: make sure cancellable object is always cancelled in ev_job_cancel() X-Git-Tag: EVINCE_2_91_4~57 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=87084fb2aabc726343f6515c09ac6d2bba42afb1;p=evince.git 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. --- diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c index ee58943e..3a74876c 100644 --- a/libview/ev-jobs.c +++ b/libview/ev-jobs.c @@ -216,7 +216,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); @@ -225,6 +225,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); }