summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-04-16 09:32:35 +0000
committerStefan Schmidt <s.schmidt@samsung.com>2020-04-16 14:53:33 +0200
commit7cc2b11f19a08be1eb43459b2af8ef42f17dede5 (patch)
treeb9021cf3bd82c569ea227a05b0337aebfdb192b3
parent8e1e1e5cf830e725594d8e38ef5c6711ca7d3de4 (diff)
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
-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_
56Eina_Stringshare* 56Eina_Stringshare*
57available_types(Eina_Array *acceptable_types, Eina_Array *available_types) 57available_types(Eina_Array *acceptable_types, Eina_Array *available_types)
58{ 58{
59 unsigned int found_type_id = INT_MAX;
60 Eina_Stringshare *found_type = NULL; 59 Eina_Stringshare *found_type = NULL;
61 Eina_Stringshare *type; 60 Eina_Stringshare *type;
62 61
63 for (unsigned int i = 0; i < eina_array_count_get(acceptable_types); ++i) 62 for (unsigned int i = 0; i < eina_array_count_get(available_types); ++i)
64 { 63 {
65 unsigned int out = -1; 64 unsigned int out = -1;
65 type = eina_array_data_get(available_types, i);
66 66
67 type = eina_array_data_get(acceptable_types, i); 67 if (!found_type && eina_array_find(acceptable_types, type, &out))
68 68 {
69 if (!eina_array_find(available_types, type, &out)) 69 found_type = eina_stringshare_ref(type);
70 continue; 70 }
71 if (out >= found_type_id)
72 continue;
73 found_type_id = out;
74 found_type = type;
75 eina_stringshare_del(type); 71 eina_stringshare_del(type);
76 } 72 }
77 eina_array_free(acceptable_types); 73 eina_array_free(acceptable_types);