desc-imc-pr3: Check g_source before removing watch
authorGuillaume Zajac <guillaume.zajac@linux.intel.com>
Mon, 29 Oct 2012 10:16:39 +0000 (11:16 +0100)
committerAuke Kok <auke-jan.h.kok@intel.com>
Fri, 8 Feb 2013 20:25:56 +0000 (12:25 -0800)
src/desc_imc_pr3.c

index 0998e0c..7ec076a 100644 (file)
@@ -450,7 +450,11 @@ static TReturn hal_setup_pdp(CoreObject *co, TcoreHalSetupPDPCallBack func,
                cdata = tcore_hal_ref_user_data(hal);
 
                if (cdata->channel) {
-                       g_source_remove(cdata->watch_id);
+                       if (cdata->watch_id > 0) {
+                               g_source_remove(cdata->watch_id);
+                               cdata->watch_id = 0;
+                       }
+
                        g_io_channel_unref(cdata->channel);
 
                        g_free(cdata);