summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-04-15 15:47:35 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-04-15 15:47:35 +0200
commit1de0f8df08887630d46b59982e8b4c6a7379f388 (patch)
treea968bde75b566e1aa5759ba77de19eecb9ee0052
parentdba78b8471f4bc96ed0a400cf991aa0cfb0f68e5 (diff)
downloadefl-devs/bu5hm4n/fixes.tar.gz
ecore_evas: fix fallback codedevs/bu5hm4n/fixes
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. CID1420331
-rw-r--r--src/lib/ecore_evas/ecore_evas_fallback_selection.c16
1 files 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);