[atspi][proxy] assign NULL after eina_stringshare_del is called. 71/103171/3
authorShinwoo Kim <cinoo.kim@samsung.com>
Wed, 7 Dec 2016 11:38:26 +0000 (20:38 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 8 Dec 2016 11:01:35 +0000 (03:01 -0800)
The _pd->path, _pd->bus could be accessed when the proxy is deleted to send signal of ATSPI_OBJECT_CHILD_REMOVED.
See the following backtrace:

0  0xb67b1c04 in raise () from /lib/libc.so.6
1  0xb67b2f98 in abort () from /lib/libc.so.6
2  0xb40bf258 in _dbus_abort () at dbus-sysdeps.c:91
3  0xb40b87be in _dbus_warn_check_failed (
   format=0xb40c5080 "arguments to %s() were incorrect, assertion \"%s\" failed in file %s line %d.\nThis is normally a bug in some application using the D-Bus library.\n") at dbus-internals.c:275
4  0xb40ae8dc in dbus_message_iter_append_basic (iter=<optimized out>,
   type=111, value=0x1, value@entry=0xbee78bc0) at dbus-message.c:2865
5  0xb61d194a in append_basic (type=type@entry=12 '\f', vl=0xbee78bec,
   vl@entry=0xbee78bd4, iter=iter@entry=0xb8728db0)
   at lib/eldbus/eldbus_message.c:449
6  0xb61d323e in eldbus_message_iter_basic_append (
   iter=iter@entry=0xb8728da0, type=111) at lib/eldbus/eldbus_message.c:566
7  0xb6d2792c in _bridge_iter_object_reference_append (
   bridge=bridge@entry=0x8000341b, iter=0xb837de90, obj=obj@entry=0x80100e0c)
   at elm_atspi_bridge.c:3233
8  0xb6d27a32 in _on_object_del (data=0x8000341b, obj=0x80100e0c,
   event=<optimized out>, event_info=<optimized out>)
   at elm_atspi_bridge.c:4480
9  0xb6d26e0c in _bridge_accessible_event_dispatch (data=0x8000341b,
   accessible=0x80100e0c,
   desc=0xb6e7c0f4 <_ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_REMOVED>,
--Type <return> to continue, or q <return> to quit---
   event_info=0x0) at elm_atspi_bridge.c:4660
10 0xb6d94778 in _elm_interface_atspi_accessible_event_emit (
   class=<optimized out>, pd=<optimized out>, accessible=0x80100e0c,
   event=0xb6e7c0f4 <_ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_REMOVED>,
   event_info=0x0) at elm_interface_atspi_accessible.c:486
11 0xb6d9407c in elm_interface_atspi_accessible_event_emit (
   accessible=accessible@entry=0x80100e0c,
   event=0xb6e7c0f4 <_ELM_INTERFACE_ATSPI_ACCESSIBLE_EVENT_REMOVED>,
   event_info=event_info@entry=0x0) at elm_interface_atspi_accessible.eo.c:124
12 0xb6e0f918 in _elm_widget_eo_base_destructor (obj=0x80100e0c,
   sd=0xb87504b0) at elm_widget.c:6101
13 0xb6716108 in eo_destructor () at lib/eo/eo_base.eo.c:34
14 0xb6d254d6 in _elm_atspi_proxy_eo_base_destructor (obj=0x80100e0c,
    _pd=<optimized out>) at elm_atspi_proxy.c:88

Change-Id: Iad77033d7ba6e85799bcc17bd09efa29d5c85440

src/lib/elm_atspi_bridge.c
src/lib/elm_atspi_proxy.c

index 7c3252c..09a463e 100644 (file)
@@ -3222,7 +3222,7 @@ _bridge_iter_object_reference_append(Eo *bridge, Eldbus_Message_Iter *iter, cons
         eo_do(obj, elm_obj_atspi_proxy_address_get(&pbus, &ppath));
         if (!pbus || !ppath)
           {
-             ERR("Invalid proxy address! Address not set before connecting/listening?");
+             DBG("Invalid proxy address! Address not set before connecting/listening. Or after proxy is removed.");
              const char *path = _bridge_path_from_object(bridge, obj);
              eldbus_message_iter_basic_append(iter_struct, 's', eldbus_connection_unique_name_get(pd->a11y_bus));
              eldbus_message_iter_basic_append(iter_struct, 'o', path);
index 86aef38..2de8dc4 100644 (file)
@@ -82,8 +82,16 @@ _elm_atspi_proxy_eo_base_destructor(Eo *obj, Elm_Atspi_Proxy_Data *_pd)
    if (_pd->type == ELM_ATSPI_PROXY_TYPE_SOCKET)
       _socket_list = eina_list_remove(_socket_list, obj);
 
-   if (_pd->bus) eina_stringshare_del(_pd->bus);
-   if (_pd->path) eina_stringshare_del(_pd->path);
+   if (_pd->bus)
+     {
+        eina_stringshare_del(_pd->bus);
+        _pd->bus = NULL;
+     }
+   if (_pd->path)
+     {
+        eina_stringshare_del(_pd->path);
+        _pd->path = NULL;
+     }
 
    eo_do_super(obj, ELM_ATSPI_PROXY_CLASS, eo_destructor());
 }