[evolution] Bug 622547 - mail_async_event_destroy() doesn't cancel its idle callback
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 622547 - mail_async_event_destroy() doesn't cancel its idle callback
- Date: Thu, 24 Jun 2010 15:14:06 +0000 (UTC)
commit 6f014d4779a7bf13d39cdc6eea153cb40dba1b24
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Jun 24 11:12:53 2010 -0400
Bug 622547 - mail_async_event_destroy() doesn't cancel its idle callback
mail/mail-mt.c | 19 +++++++++++++------
mail/mail-mt.h | 2 +-
2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index de59213..76a6ccc 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 5cfbf2a..261b376 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]