mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 21:16:15 +01:00
gdbus: don't send unexpected replies
gdbus sets NO_REPLY_EXPECTED when no callback is given to g_dbus_connection_call(). It makes sense that it also handles the server side correctly by discarding replies to clients that don't want one. https://bugzilla.gnome.org/show_bug.cgi?id=755421
This commit is contained in:
parent
5dbb3453d7
commit
dbea81b02d
@ -394,6 +394,16 @@ g_dbus_method_invocation_return_value_internal (GDBusMethodInvocation *invocatio
|
||||
g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation));
|
||||
g_return_if_fail ((parameters == NULL) || g_variant_is_of_type (parameters, G_VARIANT_TYPE_TUPLE));
|
||||
|
||||
if (g_dbus_message_get_flags (invocation->message) & G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED)
|
||||
{
|
||||
if (parameters != NULL)
|
||||
{
|
||||
g_variant_ref_sink (parameters);
|
||||
g_variant_unref (parameters);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (parameters == NULL)
|
||||
parameters = g_variant_new_tuple (NULL, 0);
|
||||
|
||||
@ -747,6 +757,9 @@ g_dbus_method_invocation_return_dbus_error (GDBusMethodInvocation *invocation,
|
||||
g_return_if_fail (error_name != NULL && g_dbus_is_name (error_name));
|
||||
g_return_if_fail (error_message != NULL);
|
||||
|
||||
if (g_dbus_message_get_flags (invocation->message) & G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED)
|
||||
goto out;
|
||||
|
||||
if (G_UNLIKELY (_g_dbus_debug_return ()))
|
||||
{
|
||||
_g_dbus_debug_print_lock ();
|
||||
@ -773,5 +786,6 @@ g_dbus_method_invocation_return_dbus_error (GDBusMethodInvocation *invocation,
|
||||
g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
|
||||
g_object_unref (reply);
|
||||
|
||||
out:
|
||||
g_object_unref (invocation);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user