mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-05 23:48:44 +02:00
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>
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user