summaryrefslogtreecommitdiffstats
path: root/glib
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@codefactory.se>2003-02-16 12:57:26 +0000
committerAnders Carlsson <andersca@codefactory.se>2003-02-16 12:57:26 +0000
commitbf07fc88a330061c59186bf4a11218b5d51aec6f (patch)
tree07420d47c9c30efe57903bd0295b08a920e90a1b /glib
parent50137daea3b57a6f862691dad4f412bcc041e9bb (diff)
2003-02-16 Anders Carlsson <andersca@codefactory.se>
* dbus/dbus-auth.c: (client_try_next_mechanism): Plug a leak. * dbus/dbus-threads.c: (dbus_condvar_wait_timeout): Return TRUE if there's no thread implementation around. * glib/dbus-gmain.c: (free_source), (dbus_connection_hookup_with_g_main): Make sure to remove the GSource when the connection is finalized.
Diffstat (limited to 'glib')
-rw-r--r--glib/dbus-gmain.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/glib/dbus-gmain.c b/glib/dbus-gmain.c
index 857ee37e..f8355a3f 100644
--- a/glib/dbus-gmain.c
+++ b/glib/dbus-gmain.c
@@ -36,6 +36,8 @@ struct _DBusGSource
GHashTable *watches;
};
+static int connection_slot = -1;
+
static gboolean dbus_connection_prepare (GSource *source,
gint *timeout);
static gboolean dbus_connection_check (GSource *source);
@@ -206,6 +208,12 @@ remove_timeout (DBusTimeout *timeout,
g_source_remove (timeout_tag);
}
+static void
+free_source (GSource *source)
+{
+ g_source_destroy (source);
+}
+
void
dbus_connection_hookup_with_g_main (DBusConnection *connection)
{
@@ -228,4 +236,11 @@ dbus_connection_hookup_with_g_main (DBusConnection *connection)
NULL, NULL);
g_source_attach (source, NULL);
+
+ if (connection_slot == -1 )
+ connection_slot = dbus_connection_allocate_data_slot ();
+
+ dbus_connection_set_data (connection, connection_slot, source,
+ (DBusFreeFunction)free_source);
+
}