[evolution-data-server] CamelIMAPXJob: Reference the job when queueing.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] CamelIMAPXJob: Reference the job when queueing.
- Date: Fri, 2 Dec 2011 06:17:43 +0000 (UTC)
commit f2348211a0c659b98ada906732a3895a8d81250d
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Dec 1 20:50:59 2011 -0600
CamelIMAPXJob: Reference the job when queueing.
Reference is dropped after dequeueing in imapx_job_done().
camel/providers/imapx/camel-imapx-server.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 454adcb..87aedc4 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -2242,18 +2242,17 @@ static void
imapx_job_done (CamelIMAPXServer *is,
CamelIMAPXJob *job)
{
- QUEUE_LOCK (is);
- g_queue_remove (&is->jobs, job);
- QUEUE_UNLOCK (is);
-
- if (job->noreply)
- imapx_job_unref (job);
- else {
+ if (!job->noreply) {
g_mutex_lock (job->done_mutex);
job->done_flag = TRUE;
g_cond_broadcast (job->done_cond);
g_mutex_unlock (job->done_mutex);
}
+
+ QUEUE_LOCK (is);
+ if (g_queue_remove (&is->jobs, job))
+ imapx_job_unref (job);
+ QUEUE_UNLOCK (is);
}
static gboolean
@@ -2263,7 +2262,7 @@ imapx_register_job (CamelIMAPXServer *is,
{
if (is->state >= IMAPX_INITIALISED) {
QUEUE_LOCK (is);
- g_queue_push_head (&is->jobs, job);
+ g_queue_push_head (&is->jobs, imapx_job_ref (job));
QUEUE_UNLOCK (is);
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]