summaryrefslogtreecommitdiffstats
path: root/glib/dbus-gmain.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-06-22 19:39:47 +0000
committerHavoc Pennington <hp@redhat.com>2003-06-22 19:39:47 +0000
commit6843ad31769c088ca259020fd9ea8dfb3a51f68e (patch)
tree208e287bc200298da5514f4d32704f3e8ef42423 /glib/dbus-gmain.c
parent8a71cf33ef8f35669dbdb39ef2f12c5a3dfebf33 (diff)
2003-06-22 Havoc Pennington <hp@pobox.com>
* dbus/dbus-dataslot.c (_dbus_data_slot_allocator_unref) (_dbus_data_slot_allocator_alloc): rework these to keep a reference count on each slot and automatically manage a global slot ID variable passed in by address * bus/bus.c: convert to new dataslot API * dbus/dbus-bus.c: convert to new dataslot API * dbus/dbus-connection.c: convert to new dataslot API * dbus/dbus-server.c: convert to new dataslot API * glib/dbus-gmain.c: ditto * bus/test.c: ditto * bus/connection.c: ditto
Diffstat (limited to 'glib/dbus-gmain.c')
-rw-r--r--glib/dbus-gmain.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/glib/dbus-gmain.c b/glib/dbus-gmain.c
index c120a6c1..9b14049d 100644
--- a/glib/dbus-gmain.c
+++ b/glib/dbus-gmain.c
@@ -60,10 +60,8 @@ struct DBusGSource
void *connection_or_server; /**< DBusConnection or DBusServer */
};
-static GStaticMutex connection_slot_lock = G_STATIC_MUTEX_INIT;
-static int connection_slot = -1;
-static GStaticMutex server_slot_lock = G_STATIC_MUTEX_INIT;
-static int server_slot = -1;
+static dbus_int32_t connection_slot = -1;
+static dbus_int32_t server_slot = -1;
static gboolean gsource_connection_prepare (GSource *source,
gint *timeout);
@@ -428,11 +426,10 @@ dbus_connection_setup_with_g_main (DBusConnection *connection,
g_source_attach (source, context);
- g_static_mutex_lock (&connection_slot_lock);
- if (connection_slot == -1 )
- connection_slot = dbus_connection_allocate_data_slot ();
- g_static_mutex_unlock (&connection_slot_lock);
-
+ /* FIXME we never free the slot, so its refcount just keeps growing,
+ * which is kind of broken.
+ */
+ dbus_connection_allocate_data_slot (&connection_slot);
if (connection_slot < 0)
goto nomem;
@@ -476,11 +473,10 @@ dbus_server_setup_with_g_main (DBusServer *server,
g_source_attach (source, context);
- g_static_mutex_lock (&server_slot_lock);
- if (server_slot == -1 )
- server_slot = dbus_server_allocate_data_slot ();
- g_static_mutex_unlock (&server_slot_lock);
-
+ /* FIXME we never free the slot, so its refcount just keeps growing,
+ * which is kind of broken.
+ */
+ dbus_server_allocate_data_slot (&server_slot);
if (server_slot < 0)
goto nomem;