Commit dbea81b0 authored by Lars Uebernickel's avatar Lars Uebernickel Committed by Allison Karlitskaya

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
parent 5dbb3453
......@@ -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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment