Fix for crash due to call to eina_error_set when bridge object is null 76/196676/6
authorRadoslaw Cybulski <r.cybulski@partner.samsung.com>
Thu, 3 Jan 2019 10:34:55 +0000 (11:34 +0100)
committerLukasz Oleksak <l.oleksak@samsung.com>
Fri, 4 Jan 2019 11:44:10 +0000 (11:44 +0000)
In some scenarios it's possible to call _bridge_object_unregister
function, when bridge object was not constructed, which resulted in
call eina_error_set and possibly crash. This patch adds an if check
for existence of bridge object.

Change-Id: Ic1995f1c0728c08c0cc007f5476d7a68a8a1d5ed

src/lib/elementary/elm_atspi_bridge.c

index 1c3c6ec..076c59e 100644 (file)
@@ -6224,7 +6224,8 @@ _bridge_object_unregister(Eo *bridge, Eo *obj)
 {
    ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(bridge, pd);
 
-   eina_hash_del(pd->cache, &obj, obj);
+   if (pd->cache)
+     eina_hash_del(pd->cache, &obj, obj);
 }
 
 static void
@@ -6247,7 +6248,8 @@ void
 unregister_atspi_object_in_bridge(const Eo *obj)
 {
    Eo *bridge = _elm_atspi_bridge_get();
-   _bridge_object_unregister(bridge, obj);
+   if (bridge)
+     _bridge_object_unregister(bridge, obj);
 }
 //