summaryrefslogtreecommitdiff
path: root/unit/test-avdtp.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@ubuntu.com>2014-01-06 12:07:00 +0000
committerJohan Hedberg <johan.hedberg@intel.com>2014-01-06 21:27:31 +0200
commit139159cfd158afa8bf747d56e7cf5bfff09a48e0 (patch)
tree39b661583b8bc5d7c6830eec79ed7300bd65d342 /unit/test-avdtp.c
parent26381ed7d895f3bf4d704039df1a4d29b06ca5b2 (diff)
downloadbluez-139159cfd158afa8bf747d56e7cf5bfff09a48e0.tar.gz
unit: Fix test failures with glib 2.39.0
glib 2.39.0 made this change: - g_source_remove() will now throw a critical in the case that you try to remove a non-existent source. We expect that there is some code in the wild that will fall afoul of this new critical but considering that we now reuse source IDs, this code is already broken and should probably be fixed. This patch fixes the test suite to keep better track of whether sources have already been removed and avoid double-removals.
Diffstat (limited to 'unit/test-avdtp.c')
-rw-r--r--unit/test-avdtp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c
index 66c45f375..6e5131365 100644
--- a/unit/test-avdtp.c
+++ b/unit/test-avdtp.c
@@ -143,6 +143,7 @@ static gboolean send_pdu(gpointer user_data)
if (pdu->fragmented)
return send_pdu(user_data);
+ context->process = 0;
return FALSE;
}
@@ -178,8 +179,10 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
pdu = &context->data->pdu_list[context->pdu_offset++];
- if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP))
+ if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
+ context->source = 0;
return FALSE;
+ }
fd = g_io_channel_unix_get_fd(channel);
@@ -258,7 +261,8 @@ static void execute_context(struct context *context)
{
g_main_loop_run(context->main_loop);
- g_source_remove(context->source);
+ if (context->source > 0)
+ g_source_remove(context->source);
avdtp_unref(context->session);
g_main_loop_unref(context->main_loop);