OSDN Git Service

Remove watch properly when doing bt_cancel_discovery.
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>
Wed, 6 May 2009 12:21:45 +0000 (09:21 -0300)
committerJohan Hedberg <johan.hedberg@nokia.com>
Wed, 6 May 2009 14:57:57 +0000 (17:57 +0300)
Any watch listen on sdp socket should be removed since the user_data is
most likely to be freed and no callback should be called after it.

common/glib-helper.c

index bdee098..c06b32c 100644 (file)
@@ -283,8 +283,9 @@ static gboolean connect_watch(GIOChannel *chan, GIOCondition cond, gpointer user
        sdp_list_free(search, NULL);
 
        /* Set callback responsible for update the internal SDP transaction */
-       g_io_add_watch(chan, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
-                       search_process_cb, ctxt);
+       ctxt->io_id = g_io_add_watch(chan,
+                               G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+                               search_process_cb, ctxt);
        return FALSE;
 
 failed: