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 <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D11712
This commit is contained in:
Marcel Hollerbach 2020-04-16 09:32:35 +00:00 committed by Stefan Schmidt
parent 8e1e1e5cf8
commit 7cc2b11f19
1 changed files with 6 additions and 10 deletions

View File

@ -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);