summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-03-28 17:41:36 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2012-03-28 17:47:35 +0100
commit283b25fae9573e495adf152c0dc5e025e1e599c6 (patch)
treeefd652e84204572f043300a3a29822fc75a8600e
parent081c0684259606b72f5bb8fe4ad36bfdc87ef180 (diff)
downloadtelepathy-glib-283b25fae9573e495adf152c0dc5e025e1e599c6.tar.gz
dbus-tube test: return TRUE from ::new-connection handler
The documentation for GDBusServer::new-connection says: > If you want to accept the connection, take a reference to the connection > object and return TRUE. We were not doing this—the callback returned void. So random bytes from the stack were interpreted as a boolean. The result on my machine was that this test case passed when run in isolation (-p /dbus-tube/offer) but failed when test-dbus-tube ran as a whole. This is presumably because GDBusServer does this: if (claimed) g_dbus_connection_start_message_processing (data->connection); So if we happened to "return" a false value, the connection never got started.
-rw-r--r--tests/dbus/dbus-tube.c4
-rw-r--r--tests/lib/dbus-tube-chan.c13
2 files changed, 11 insertions, 6 deletions
diff --git a/tests/dbus/dbus-tube.c b/tests/dbus/dbus-tube.c
index cc42fd35b..e68d5d25a 100644
--- a/tests/dbus/dbus-tube.c
+++ b/tests/dbus/dbus-tube.c
@@ -231,7 +231,7 @@ tube_offer_cb (GObject *source,
g_main_loop_quit (test->mainloop);
}
-static void
+static gboolean
new_connection_cb (TpTestsDBusTubeChannel *chan,
GDBusConnection *connection,
Test *test)
@@ -242,6 +242,8 @@ new_connection_cb (TpTestsDBusTubeChannel *chan,
test->wait--;
if (test->wait <= 0)
g_main_loop_quit (test->mainloop);
+
+ return TRUE;
}
static void
diff --git a/tests/lib/dbus-tube-chan.c b/tests/lib/dbus-tube-chan.c
index 283742987..3660d2e93 100644
--- a/tests/lib/dbus-tube-chan.c
+++ b/tests/lib/dbus-tube-chan.c
@@ -261,9 +261,10 @@ tp_tests_dbus_tube_channel_class_init (TpTestsDBusTubeChannelClass *klass)
_signals[SIG_NEW_CONNECTION] = g_signal_new ("new-connection",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
+ 0,
+ g_signal_accumulator_true_handled, NULL,
+ NULL,
+ G_TYPE_BOOLEAN,
1, G_TYPE_DBUS_CONNECTION);
tp_dbus_properties_mixin_implement_interface (object_class,
@@ -289,14 +290,16 @@ change_state (TpTestsDBusTubeChannel *self,
tp_svc_channel_interface_tube_emit_tube_channel_state_changed (self, state);
}
-static void
+static gboolean
dbus_new_connection_cb (GDBusServer *server,
GDBusConnection *connection,
gpointer user_data)
{
TpTestsDBusTubeChannel *self = user_data;
+ gboolean ret = FALSE;
- g_signal_emit (self, _signals[SIG_NEW_CONNECTION], 0, connection);
+ g_signal_emit (self, _signals[SIG_NEW_CONNECTION], 0, connection, &ret);
+ return ret;
}
static void