efl_access: add free function to Efl_Access_Text_Range struct

Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D7717
This commit is contained in:
Lukasz Stanislawski 2019-01-22 06:59:50 +00:00 committed by Marcel Hollerbach
parent d326b3e6e1
commit 256367384a
4 changed files with 15 additions and 5 deletions

View File

@ -17,4 +17,11 @@ EAPI elm_atspi_text_text_attribute_free(Efl_Access_Text_Attribute *attr)
free(attr);
}
EAPI void
elm_atspi_text_text_range_free(Efl_Access_Text_Range *range)
{
free(range->content);
free(range);
}
#include "efl_access_text.eo.c"

View File

@ -27,7 +27,7 @@ struct Efl.Access.Text_Attribute
value: string; [[Text attribute value]]
}
struct Efl.Access.Text_Range
struct @free(elm_atspi_text_text_range_free) Efl.Access.Text_Range
{
[[Text range]]
start_offset: int; [[Range start offset]]

View File

@ -15,5 +15,10 @@
*/
EAPI void elm_atspi_text_text_attribute_free(Efl_Access_Text_Attribute *attr);
/**
* @brief Free Efl_Access_Text_Range structure
*/
EAPI void elm_atspi_text_text_range_free(Efl_Access_Text_Range *range);
#endif
#endif

View File

@ -1755,8 +1755,7 @@ _text_bounded_ranges_get(const Eldbus_Service_Interface *iface, const Eldbus_Mes
{
eldbus_message_iter_basic_append(iter_struct, 'i', range->start_offset);
eldbus_message_iter_basic_append(iter_struct, 'i', range->end_offset);
range->content = range->content ? range->content : strdup("");
eldbus_message_iter_basic_append(iter_struct, 's', range->content);
eldbus_message_iter_basic_append(iter_struct, 's', range->content ? range->content : "");
/* AT-SPI specification requires variant type in return, however
* ATK or other implementations as well as AT Clients don't use it .
* To cover spec a dummy value will be returned */
@ -1768,8 +1767,7 @@ _text_bounded_ranges_get(const Eldbus_Service_Interface *iface, const Eldbus_Mes
}
eldbus_message_iter_container_close(iter_array, iter_struct);
}
if (range->content) free(range->content);
free(range);
elm_atspi_text_text_range_free(range);
}
eldbus_message_iter_container_close(iter, iter_array);