diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-10-15 15:40:59 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2008-10-15 15:40:59 +0000 |
commit | 8dfb40eb2de2f1ba546010679c3470670cfc3719 (patch) | |
tree | a3b4b4ef1c3bc655ca238a96dbc9ae1555d57e5d /navit/event_glib.c | |
parent | 82f8d2849b853497066482095a59ccc647264af1 (diff) | |
download | navit-8dfb40eb2de2f1ba546010679c3470670cfc3719.tar.gz |
Fix:Core:Changed core to use event functions instead of glib ones
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1473 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/event_glib.c')
-rw-r--r-- | navit/event_glib.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/navit/event_glib.c b/navit/event_glib.c index 69e6358d2..f7d67c3cf 100644 --- a/navit/event_glib.c +++ b/navit/event_glib.c @@ -66,6 +66,8 @@ static void event_glib_remove_watch(struct event_watch *ev) { GError *error = NULL; + if (! ev) + return; g_source_remove(ev->source); g_io_channel_shutdown(ev->iochan, 0, &error); g_free(ev); @@ -73,21 +75,21 @@ event_glib_remove_watch(struct event_watch *ev) struct event_timeout { guint source; + struct callback *cb; }; static gboolean -event_glib_call_timeout_single(gpointer t) +event_glib_call_timeout_single(struct event_timeout *ev) { - struct callback *cb=t; - callback_call_0(cb); + callback_call_0(ev->cb); + g_free(ev); return FALSE; } static gboolean -event_glib_call_timeout_multi(gpointer t) +event_glib_call_timeout_multi(struct event_timeout *ev) { - struct callback *cb=t; - callback_call_0(cb); + callback_call_0(ev->cb); return TRUE; } @@ -96,7 +98,8 @@ static struct event_timeout * event_glib_add_timeout(int timeout, int multi, struct callback *cb) { struct event_timeout *ret=g_new0(struct event_timeout, 1); - ret->source = g_timeout_add(timeout, multi ? (GSourceFunc)event_glib_call_timeout_multi : (GSourceFunc)event_glib_call_timeout_single, (gpointer)cb); + ret->cb=cb; + ret->source = g_timeout_add(timeout, multi ? (GSourceFunc)event_glib_call_timeout_multi : (GSourceFunc)event_glib_call_timeout_single, (gpointer)ret); return ret; } @@ -104,6 +107,8 @@ event_glib_add_timeout(int timeout, int multi, struct callback *cb) static void event_glib_remove_timeout(struct event_timeout *ev) { + if (! ev) + return; g_source_remove(ev->source); g_free(ev); } |