[PATCH 1/2] unit: Fix removing invalid source in test-hfp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since GLib 2.39 calling g_source_remove on already removed source
is causing critical warning. This was causing unit/test-hfp to
fail when running with GLib 2.40.

./unit/test-hfp
/hfp/test_init:
(./unit/test-hfp:28878): GLib-CRITICAL **: Source ID 1 was not found
    when attempting to remove it
Trace/breakpoint trap
---
 unit/test-hfp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index 445fcb7..20aa0b5 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -121,6 +121,8 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
 	g_assert(!pdu->valid);
 	context_quit(context);
 
+	context->watch_id = 0;
+
 	return FALSE;
 }
 
@@ -187,7 +189,8 @@ static void execute_context(struct context *context)
 {
 	g_main_loop_run(context->main_loop);
 
-	g_source_remove(context->watch_id);
+	if (context->watch_id)
+		g_source_remove(context->watch_id);
 
 	g_main_loop_unref(context->main_loop);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux