OSDN Git Service

network: Fix warning when removing connection timeout handler
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 23 Aug 2012 15:40:00 +0000 (18:40 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 24 Aug 2012 07:49:20 +0000 (10:49 +0300)
The source should only be removed once as it can cause the following
warning:

GLib-CRITICAL **: g_source_remove: assertion `tag > 0' failed

profiles/network/connection.c

index 59423a9..e8ac643 100644 (file)
@@ -207,8 +207,10 @@ static gboolean bnep_setup_cb(GIOChannel *chan, GIOCondition cond,
        if (cond & G_IO_NVAL)
                return FALSE;
 
-       g_source_remove(nc->timeout_source);
-       nc->timeout_source = 0;
+       if (nc->timeout_source > 0) {
+               g_source_remove(nc->timeout_source);
+               nc->timeout_source = 0;
+       }
 
        if (cond & (G_IO_HUP | G_IO_ERR)) {
                error("Hangup or error on l2cap server socket");