stefan pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7cc2b11f19a08be1eb43459b2af8ef42f17dede5
commit 7cc2b11f19a08be1eb43459b2af8ef42f17dede5 Author: Marcel Hollerbach <[email protected]> Date: Thu Apr 16 09:32:35 2020 +0000 ecore_evas: fix fallback code this was using a stringshare reference that was deleted. While that is true, the stringshare reference will always be alive, because 2 people took a reference. Anyways, this code is now searching the other way arround, which makes the code also easier. fixes: CID1420331 Reviewed-by: Stefan Schmidt <[email protected]> Differential Revision: https://phab.enlightenment.org/D11712 --- src/lib/ecore_evas/ecore_evas_fallback_selection.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lib/ecore_evas/ecore_evas_fallback_selection.c b/src/lib/ecore_evas/ecore_evas_fallback_selection.c index b3f59c7921..1abdfa29cd 100644 --- a/src/lib/ecore_evas/ecore_evas_fallback_selection.c +++ b/src/lib/ecore_evas/ecore_evas_fallback_selection.c @@ -56,22 +56,18 @@ fallback_selection_has_owner(Ecore_Evas *ee EINA_UNUSED, unsigned int seat EINA_ Eina_Stringshare* available_types(Eina_Array *acceptable_types, Eina_Array *available_types) { - unsigned int found_type_id = INT_MAX; Eina_Stringshare *found_type = NULL; Eina_Stringshare *type; - for (unsigned int i = 0; i < eina_array_count_get(acceptable_types); ++i) + for (unsigned int i = 0; i < eina_array_count_get(available_types); ++i) { unsigned int out = -1; + type = eina_array_data_get(available_types, i); - type = eina_array_data_get(acceptable_types, i); - - if (!eina_array_find(available_types, type, &out)) - continue; - if (out >= found_type_id) - continue; - found_type_id = out; - found_type = type; + if (!found_type && eina_array_find(acceptable_types, type, &out)) + { + found_type = eina_stringshare_ref(type); + } eina_stringshare_del(type); } eina_array_free(acceptable_types); --
