make sure priv->adapter exists before unref it when freeing gap agent 00/28700/1 accepted/tizen/common/20141015.065241 submit/tizen/20141015.022242
authorCorentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>
Tue, 14 Oct 2014 08:45:18 +0000 (10:45 +0200)
committerCorentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>
Tue, 14 Oct 2014 09:02:59 +0000 (11:02 +0200)
It fixes such error :
GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT (object)' failed

Also it makes no sense to reference priv->adapter pointer before setting it
to NULL. So unref priv->adapter it instead.

Change-Id: I0b27d0d16192e8e647ffc00fd9704a90700417b2
Signed-off-by: Corentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>
bt-service/bt-service-gap-agent.c

index 3a876d1..3dd00e3 100644 (file)
@@ -1031,8 +1031,10 @@ void _gap_agent_reset_dbus(GapAgent *agent)
                priv->osp_servers = NULL;
        }
 
-       g_object_ref(priv->adapter);
-       priv->adapter = NULL;
+       if (priv->adapter) {
+               g_object_unref(priv->adapter);
+               priv->adapter = NULL;
+       }
 
        g_free(priv->path);
        priv->path = NULL;