diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-01 23:53:58 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-21 19:39:08 +0800 |
commit | c80fb17f32ce997a631e228a7b6fd89d2120a09d (patch) | |
tree | 0ca8491fe78fe57f2f3d376fbea2c4f5c8c5f27b | |
parent | 4d26e574b71c760e752a70eb5f2eb448b63f93e4 (diff) | |
download | gsoc2013-empathy-c80fb17f32ce997a631e228a7b6fd89d2120a09d.tar gsoc2013-empathy-c80fb17f32ce997a631e228a7b6fd89d2120a09d.tar.gz gsoc2013-empathy-c80fb17f32ce997a631e228a7b6fd89d2120a09d.tar.bz2 gsoc2013-empathy-c80fb17f32ce997a631e228a7b6fd89d2120a09d.tar.lz gsoc2013-empathy-c80fb17f32ce997a631e228a7b6fd89d2120a09d.tar.xz gsoc2013-empathy-c80fb17f32ce997a631e228a7b6fd89d2120a09d.tar.zst gsoc2013-empathy-c80fb17f32ce997a631e228a7b6fd89d2120a09d.zip |
event-manager: remove the auto-remove timer when the event is destroyed
This avoid to crash when trying to re-remove an old event (#603485).
-rw-r--r-- | src/empathy-event-manager.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index 72708b6b5..c9e925d21 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -96,6 +96,7 @@ struct _EventPriv { EventFunc func; gboolean inhibit; gpointer user_data; + guint autoremove_timeout_id; }; enum { @@ -160,6 +161,9 @@ event_free (EventPriv *event) g_free (event->public.header); g_free (event->public.message); + if (event->autoremove_timeout_id != 0) + g_source_remove (event->autoremove_timeout_id); + if (event->public.contact) { g_object_unref (event->public.contact); @@ -174,6 +178,7 @@ event_remove (EventPriv *event) EmpathyEventManagerPriv *priv = GET_PRIV (event->manager); DEBUG ("Removing event %p", event); + priv->events = g_slist_remove (priv->events, event); g_signal_emit (event->manager, signals[EVENT_REMOVED], 0, event); event_free (event); @@ -182,6 +187,7 @@ event_remove (EventPriv *event) static gboolean autoremove_event_timeout_cb (EventPriv *event) { + event->autoremove_timeout_id = 0; event_remove (event); return FALSE; } @@ -219,8 +225,9 @@ event_manager_add (EmpathyEventManager *manager, if (!event->public.must_ack) { - g_timeout_add_seconds (NOTIFICATION_TIMEOUT, - (GSourceFunc) autoremove_event_timeout_cb, event); + event->autoremove_timeout_id = g_timeout_add_seconds ( + NOTIFICATION_TIMEOUT, (GSourceFunc) autoremove_event_timeout_cb, + event); } } |