diff options
| author | David Zeuthen <davidz@redhat.com> | 2010-06-29 15:19:56 -0400 |
|---|---|---|
| committer | David Zeuthen <davidz@redhat.com> | 2010-06-29 15:21:11 -0400 |
| commit | 6d4ade4cf0d6ed64ce59f3db4f270be08a4478fd (patch) | |
| tree | 95e8c9d9b1afa8ea1d1ee25b98eb1abcc36b66ba /gio/gdbusnameowning.c | |
| parent | ab6b6c68c5b060057fd2953435c090b4d53fe93c (diff) | |
| download | glib-6d4ade4cf0d6ed64ce59f3db4f270be08a4478fd.tar.gz | |
Bug 623143 – Never require non-closed connections
There's a couple of places in GDBus where it's a programming error
(e.g. we'll assert or spew via e.g. g_warning()) to use the API on a
closed connection. This approach can never work since a
GDBusConnection can be closed at any point in time outside of
programmer control.
Just change the code to return a run-time error (e.g. return
G_IO_ERROR_CLOSED when sending messages, invoking methods) or silently
accept the request (e.g. exporting objects, registering for signals)
without doing anything.
Note that a GDBusConnection object is always useless after being
closed - e.g. there's no way to "reopen" a connection - the user will
have to create a new object and use that instead.
https://bugzilla.gnome.org/show_bug.cgi?id=623143
Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'gio/gdbusnameowning.c')
| -rw-r--r-- | gio/gdbusnameowning.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gio/gdbusnameowning.c b/gio/gdbusnameowning.c index ba3afb9cc..2cdb0a7ba 100644 --- a/gio/gdbusnameowning.c +++ b/gio/gdbusnameowning.c @@ -450,7 +450,7 @@ connection_get_cb (GObject *source_object, /** * g_bus_own_name_on_connection: - * @connection: A #GDBusConnection that is not closed. + * @connection: A #GDBusConnection. * @name: The well-known name to own. * @flags: A set of flags from the #GBusNameOwnerFlags enumeration. * @name_acquired_handler: Handler to invoke when @name is acquired or %NULL. @@ -478,7 +478,6 @@ g_bus_own_name_on_connection (GDBusConnection *connection, Client *client; g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), 0); - g_return_val_if_fail (!g_dbus_connection_is_closed (connection), 0); g_return_val_if_fail (g_dbus_is_name (name) && !g_dbus_is_unique_name (name), 0); G_LOCK (lock); @@ -766,7 +765,7 @@ g_bus_own_name_with_closures (GBusType bus_type, /** * g_bus_own_name_on_connection_with_closures: - * @connection: A #GDBusConnection that is not closed. + * @connection: A #GDBusConnection. * @name: The well-known name to own. * @flags: A set of flags from the #GBusNameOwnerFlags enumeration. * @name_acquired_closure: (allow-none): #GClosure to invoke when @name is |
