mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-16 18:51:58 +02:00
Merge branch 'backport-4415-dbus-leak-glib-2-82' into 'glib-2-82'
Backport !4415 “gdbus: Fix leak of method invocation when registering an object with closures” to glib-2-82 See merge request GNOME/glib!4417
This commit is contained in:
commit
8f7619e140
@ -5950,7 +5950,7 @@ register_with_closures_on_method_call (GDBusConnection *connection,
|
|||||||
g_value_set_variant (¶ms[5], parameters);
|
g_value_set_variant (¶ms[5], parameters);
|
||||||
|
|
||||||
g_value_init (¶ms[6], G_TYPE_DBUS_METHOD_INVOCATION);
|
g_value_init (¶ms[6], G_TYPE_DBUS_METHOD_INVOCATION);
|
||||||
g_value_set_object (¶ms[6], invocation);
|
g_value_take_object (¶ms[6], g_steal_pointer (&invocation));
|
||||||
|
|
||||||
g_closure_invoke (data->method_call_closure, NULL, G_N_ELEMENTS (params), params, NULL);
|
g_closure_invoke (data->method_call_closure, NULL, G_N_ELEMENTS (params), params, NULL);
|
||||||
|
|
||||||
|
@ -161,6 +161,23 @@ foo_method_call (GDBusConnection *connection,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
foo_method_call_with_closure (GDBusConnection *connection,
|
||||||
|
const gchar *sender,
|
||||||
|
const gchar *object_path,
|
||||||
|
const gchar *interface_name,
|
||||||
|
const gchar *method_name,
|
||||||
|
GVariant *parameters,
|
||||||
|
GDBusMethodInvocation *invocation,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
/* The call below takes ownership of the invocation but ownership is not
|
||||||
|
* passed into the callback so get an additional reference here */
|
||||||
|
g_object_ref (invocation);
|
||||||
|
|
||||||
|
foo_method_call (connection, sender, object_path, interface_name, method_name, parameters, invocation, user_data);
|
||||||
|
}
|
||||||
|
|
||||||
static GVariant *
|
static GVariant *
|
||||||
foo_get_property (GDBusConnection *connection,
|
foo_get_property (GDBusConnection *connection,
|
||||||
const gchar *sender,
|
const gchar *sender,
|
||||||
@ -1440,7 +1457,7 @@ test_object_registration_with_closures (void)
|
|||||||
registration_id = g_dbus_connection_register_object_with_closures (c,
|
registration_id = g_dbus_connection_register_object_with_closures (c,
|
||||||
"/foo/boss",
|
"/foo/boss",
|
||||||
(GDBusInterfaceInfo *) &foo_interface_info,
|
(GDBusInterfaceInfo *) &foo_interface_info,
|
||||||
g_cclosure_new (G_CALLBACK (foo_method_call), NULL, NULL),
|
g_cclosure_new (G_CALLBACK (foo_method_call_with_closure), NULL, NULL),
|
||||||
g_cclosure_new (G_CALLBACK (foo_get_property), NULL, NULL),
|
g_cclosure_new (G_CALLBACK (foo_get_property), NULL, NULL),
|
||||||
g_cclosure_new (G_CALLBACK (foo_set_property), NULL, NULL),
|
g_cclosure_new (G_CALLBACK (foo_set_property), NULL, NULL),
|
||||||
&error);
|
&error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user