summaryrefslogtreecommitdiffstats
path: root/glib
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-14 01:27:58 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-14 01:27:58 +0000
commit3bea935316ff048e68dea6a26c2e8e9fd314477f (patch)
tree498e62121c89d78693070d04e6bc6a6462efe2a7 /glib
parent81c30364c291045d556c88f6818033104e627b6e (diff)
2003-03-13 Havoc Pennington <hp@redhat.com>
* dbus/dbus-timeout.c (_dbus_timeout_list_set_functions): handle out of memory * dbus/dbus-watch.c (_dbus_watch_list_set_functions): handle out of memory * dbus/dbus-connection.h: Make AddWatchFunction and AddTimeoutFunction return a bool so they can fail on out-of-memory * bus/bus.c (bus_context_new): set up timeout handlers * bus/connection.c (bus_connections_setup_connection): set up timeout handlers * glib/dbus-gmain.c: adapt to the fact that set_functions stuff can fail * bus/bus.c (bus_context_new): adapt to changes * bus/connection.c: adapt to changes * test/watch.c: adapt to DBusWatch changes * bus/dispatch.c (bus_dispatch_test): started adding this but didn't finish
Diffstat (limited to 'glib')
-rw-r--r--glib/dbus-gmain.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/glib/dbus-gmain.c b/glib/dbus-gmain.c
index 40523738..b0ec7c4b 100644
--- a/glib/dbus-gmain.c
+++ b/glib/dbus-gmain.c
@@ -231,7 +231,7 @@ dbus_server_dispatch (GSource *source,
return TRUE;
}
-static void
+static dbus_bool_t
add_watch (DBusWatch *watch,
gpointer data)
{
@@ -257,6 +257,8 @@ add_watch (DBusWatch *watch,
dbus_source->poll_fds = g_list_prepend (dbus_source->poll_fds, poll_fd);
g_hash_table_insert (dbus_source->watches, poll_fd, watch);
+
+ return TRUE;
}
static void
@@ -285,7 +287,7 @@ timeout_handler (gpointer data)
return FALSE;
}
-static void
+static dbus_bool_t
add_timeout (DBusTimeout *timeout,
void *data)
{
@@ -295,6 +297,8 @@ add_timeout (DBusTimeout *timeout,
timeout_handler, timeout);
dbus_timeout_set_data (timeout, GUINT_TO_POINTER (timeout_tag), NULL);
+
+ return TRUE;
}
static void
@@ -356,16 +360,18 @@ dbus_connection_setup_with_g_main (DBusConnection *connection)
source = create_source (connection, &dbus_connection_funcs);
- dbus_connection_set_watch_functions (connection,
- add_watch,
- remove_watch,
- source, NULL);
+ if (!dbus_connection_set_watch_functions (connection,
+ add_watch,
+ remove_watch,
+ source, NULL))
+ goto nomem;
- dbus_connection_set_timeout_functions (connection,
- add_timeout,
- remove_timeout,
- NULL, NULL);
-
+ if (!dbus_connection_set_timeout_functions (connection,
+ add_timeout,
+ remove_timeout,
+ NULL, NULL))
+ goto nomem;
+
dbus_connection_set_wakeup_main_function (connection,
wakeup_main,
NULL, NULL);