aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-06-24 23:12:53 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-06-24 23:12:53 +0800
commit6f014d4779a7bf13d39cdc6eea153cb40dba1b24 (patch)
treeb57d93af9d64b320987f21fb950361409f4d95f7
parentef9b23ef998f8dd4e987c5e7443a36dd48e59b2e (diff)
downloadgsoc2013-evolution-6f014d4779a7bf13d39cdc6eea153cb40dba1b24.tar
gsoc2013-evolution-6f014d4779a7bf13d39cdc6eea153cb40dba1b24.tar.gz
gsoc2013-evolution-6f014d4779a7bf13d39cdc6eea153cb40dba1b24.tar.bz2
gsoc2013-evolution-6f014d4779a7bf13d39cdc6eea153cb40dba1b24.tar.lz
gsoc2013-evolution-6f014d4779a7bf13d39cdc6eea153cb40dba1b24.tar.xz
gsoc2013-evolution-6f014d4779a7bf13d39cdc6eea153cb40dba1b24.tar.zst
gsoc2013-evolution-6f014d4779a7bf13d39cdc6eea153cb40dba1b24.zip
Bug 622547 - mail_async_event_destroy() doesn't cancel its idle callback
-rw-r--r--mail/mail-mt.c19
-rw-r--r--mail/mail-mt.h2
2 files changed, 14 insertions, 7 deletions
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index de59213ce5..76a6ccc488 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -605,6 +605,7 @@ struct _proxy_msg {
mail_async_event_t type;
GThread *thread;
+ guint idle_id;
MailAsyncFunc func;
gpointer o;
@@ -625,10 +626,11 @@ do_async_event(struct _proxy_msg *m)
}
static gint
-idle_async_event(gpointer mm)
+idle_async_event (struct _proxy_msg *m)
{
- do_async_event(mm);
- mail_msg_unref(mm);
+ m->idle_id = 0;
+ do_async_event (m);
+ mail_msg_unref (m);
return FALSE;
}
@@ -652,7 +654,7 @@ mail_async_event_new (void)
return ea;
}
-gint
+guint
mail_async_event_emit (MailAsyncEvent *ea,
mail_async_event_t type,
MailAsyncFunc func,
@@ -661,7 +663,7 @@ mail_async_event_emit (MailAsyncEvent *ea,
gpointer data)
{
struct _proxy_msg *m;
- gint id;
+ guint id;
/* We dont have a reply port for this, we dont
* care when/if it gets executed, just queue it. */
@@ -684,7 +686,8 @@ mail_async_event_emit (MailAsyncEvent *ea,
* overflow and deadlock us. */
if (type == MAIL_ASYNC_GUI) {
if (mail_in_main_thread ())
- g_idle_add(idle_async_event, m);
+ m->idle_id = g_idle_add (
+ (GSourceFunc) idle_async_event, m);
else
mail_msg_main_loop_push(m);
} else
@@ -709,6 +712,10 @@ mail_async_event_destroy (MailAsyncEvent *ea)
errno = EDEADLK;
return -1;
}
+ if (m->idle_id > 0) {
+ g_source_remove (m->idle_id);
+ m->idle_id = 0;
+ }
g_mutex_unlock(ea->lock);
mail_msg_wait(id);
g_mutex_lock(ea->lock);
diff --git a/mail/mail-mt.h b/mail/mail-mt.h
index 5cfbf2abe1..261b37699f 100644
--- a/mail/mail-mt.h
+++ b/mail/mail-mt.h
@@ -101,7 +101,7 @@ typedef void (*MailAsyncFunc)(gpointer , gpointer , gpointer );
/* create a new async event handler */
MailAsyncEvent *mail_async_event_new(void);
/* forward a camel event (or other call) to the gui thread */
-gint mail_async_event_emit(MailAsyncEvent *ea, mail_async_event_t type, MailAsyncFunc func, gpointer , gpointer , gpointer );
+guint mail_async_event_emit(MailAsyncEvent *ea, mail_async_event_t type, MailAsyncFunc func, gpointer , gpointer , gpointer );
/* wait for all outstanding async events to complete */
gint mail_async_event_destroy(MailAsyncEvent *ea);