From d3a479b7fa1d1e52f9d3950139643fe7e3ff5a57 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 10 Jan 2013 19:08:42 +0100 Subject: event/TimeoutMonitor: wrapper for g_timeout_source_new() --- src/event/Loop.hxx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/event/Loop.hxx') diff --git a/src/event/Loop.hxx b/src/event/Loop.hxx index 9c139e08e..31ef1613c 100644 --- a/src/event/Loop.hxx +++ b/src/event/Loop.hxx @@ -64,22 +64,20 @@ public: return id; } - guint AddTimeout(guint interval_ms, - GSourceFunc function, gpointer data) { + GSource *AddTimeout(guint interval_ms, + GSourceFunc function, gpointer data) { GSource *source = g_timeout_source_new(interval_ms); g_source_set_callback(source, function, data, nullptr); - guint id = g_source_attach(source, GetContext()); - g_source_unref(source); - return id; + g_source_attach(source, GetContext()); + return source; } - guint AddTimeoutSeconds(guint interval_s, - GSourceFunc function, gpointer data) { + GSource *AddTimeoutSeconds(guint interval_s, + GSourceFunc function, gpointer data) { GSource *source = g_timeout_source_new_seconds(interval_s); g_source_set_callback(source, function, data, nullptr); - guint id = g_source_attach(source, GetContext()); - g_source_unref(source); - return id; + g_source_attach(source, GetContext()); + return source; } }; -- cgit v1.2.3