GDBus: Sink closures in _with_closures functions

See https://bugzilla.gnome.org/show_bug.cgi?id=621092#c12

Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
Jürg Billeter 2010-06-18 23:48:28 +02:00 committed by David Zeuthen
parent 8f5bde679e
commit 1ed105b19b
2 changed files with 36 additions and 9 deletions

View File

@ -737,13 +737,22 @@ g_bus_own_name_with_closures (GBusType bus_type,
data = g_new0 (OwnNameData, 1);
if (bus_acquired_closure != NULL)
data->bus_acquired_closure = g_closure_ref (bus_acquired_closure);
{
data->bus_acquired_closure = g_closure_ref (bus_acquired_closure);
g_closure_sink (bus_acquired_closure);
}
if (name_acquired_closure != NULL)
data->name_acquired_closure = g_closure_ref (name_acquired_closure);
{
data->name_acquired_closure = g_closure_ref (name_acquired_closure);
g_closure_sink (name_acquired_closure);
}
if (name_lost_closure != NULL)
data->name_lost_closure = g_closure_ref (name_lost_closure);
{
data->name_lost_closure = g_closure_ref (name_lost_closure);
g_closure_sink (name_lost_closure);
}
return g_bus_own_name (bus_type,
name,
@ -787,10 +796,16 @@ g_bus_own_name_on_connection_with_closures (GDBusConnection *connection
data = g_new0 (OwnNameData, 1);
if (name_acquired_closure != NULL)
data->name_acquired_closure = g_closure_ref (name_acquired_closure);
{
data->name_acquired_closure = g_closure_ref (name_acquired_closure);
g_closure_sink (name_acquired_closure);
}
if (name_lost_closure != NULL)
data->name_lost_closure = g_closure_ref (name_lost_closure);
{
data->name_lost_closure = g_closure_ref (name_lost_closure);
g_closure_sink (name_lost_closure);
}
return g_bus_own_name_on_connection (connection,
name,

View File

@ -739,10 +739,16 @@ g_bus_watch_name_with_closures (GBusType bus_type,
data = g_new0 (WatchNameData, 1);
if (name_appeared_closure != NULL)
data->name_appeared_closure = g_closure_ref (name_appeared_closure);
{
data->name_appeared_closure = g_closure_ref (name_appeared_closure);
g_closure_sink (name_appeared_closure);
}
if (name_vanished_closure != NULL)
data->name_vanished_closure = g_closure_ref (name_vanished_closure);
{
data->name_vanished_closure = g_closure_ref (name_vanished_closure);
g_closure_sink (name_vanished_closure);
}
return g_bus_watch_name (bus_type,
name,
@ -785,10 +791,16 @@ guint g_bus_watch_name_on_connection_with_closures (
data = g_new0 (WatchNameData, 1);
if (name_appeared_closure != NULL)
data->name_appeared_closure = g_closure_ref (name_appeared_closure);
{
data->name_appeared_closure = g_closure_ref (name_appeared_closure);
g_closure_sink (name_appeared_closure);
}
if (name_vanished_closure != NULL)
data->name_vanished_closure = g_closure_ref (name_vanished_closure);
{
data->name_vanished_closure = g_closure_ref (name_vanished_closure);
g_closure_sink (name_vanished_closure);
}
return g_bus_watch_name_on_connection (connection,
name,