#include "gdbuserror.h"
#include "gdbusprivate.h"
#include "gdbusconnection.h"
-#include "gio-marshal.h"
#include "glibintl.h"
}
g_free (client->name);
g_free (client->name_owner);
- if (client->main_context != NULL)
- g_main_context_unref (client->main_context);
+ g_main_context_unref (client->main_context);
if (client->user_data_free_func != NULL)
client->user_data_free_func (client->user_data);
g_free (client);
static void
do_call (Client *client, CallType call_type)
{
+ GMainContext *current_context;
+
/* only schedule in idle if we're not in the right thread */
- if (g_main_context_get_thread_default () != client->main_context)
+ current_context = g_main_context_ref_thread_default ();
+ if (current_context != client->main_context)
schedule_call_in_idle (client, call_type);
else
actually_do_call (client, client->connection, client->name_owner, call_type);
+ g_main_context_unref (current_context);
}
static void
client->name_vanished_handler = name_vanished_handler;
client->user_data = user_data;
client->user_data_free_func = user_data_free_func;
- client->main_context = g_main_context_get_thread_default ();
- if (client->main_context != NULL)
- g_main_context_ref (client->main_context);
+ client->main_context = g_main_context_ref_thread_default ();
if (map_id_to_client == NULL)
{
client->name_vanished_handler = name_vanished_handler;
client->user_data = user_data;
client->user_data_free_func = user_data_free_func;
- client->main_context = g_main_context_get_thread_default ();
- if (client->main_context != NULL)
- g_main_context_ref (client->main_context);
+ client->main_context = g_main_context_ref_thread_default ();
if (map_id_to_client == NULL)
map_id_to_client = g_hash_table_new (g_direct_hash, g_direct_equal);
data->name_appeared_closure = g_closure_ref (name_appeared_closure);
g_closure_sink (name_appeared_closure);
if (G_CLOSURE_NEEDS_MARSHAL (name_appeared_closure))
- g_closure_set_marshal (name_appeared_closure, _gio_marshal_VOID__STRING_STRING);
+ g_closure_set_marshal (name_appeared_closure, g_cclosure_marshal_generic);
}
if (name_vanished_closure != NULL)
data->name_vanished_closure = g_closure_ref (name_vanished_closure);
g_closure_sink (name_vanished_closure);
if (G_CLOSURE_NEEDS_MARSHAL (name_vanished_closure))
- g_closure_set_marshal (name_vanished_closure, _gio_marshal_VOID__STRING);
+ g_closure_set_marshal (name_vanished_closure, g_cclosure_marshal_generic);
}
return data;
gpointer user_data)
{
WatchNameData *data = user_data;
- GValue params[3] = { { 0, }, { 0, }, { 0, } };
+ GValue params[3] = { G_VALUE_INIT, G_VALUE_INIT, G_VALUE_INIT };
g_value_init (¶ms[0], G_TYPE_DBUS_CONNECTION);
g_value_set_object (¶ms[0], connection);
gpointer user_data)
{
WatchNameData *data = user_data;
- GValue params[2] = { { 0, }, { 0, } };
+ GValue params[2] = { G_VALUE_INIT, G_VALUE_INIT };
g_value_init (¶ms[0], G_TYPE_DBUS_CONNECTION);
g_value_set_object (¶ms[0], connection);