summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2018-05-18 09:03:30 -0500
committerDerek Foreman <derekf@osg.samsung.com>2018-05-18 09:27:15 -0500
commitd04a625e029b1eaf59bde4e25430eeb3f98d4b6b (patch)
tree04cf8ca37cded64c1de9ca8f8ec0947ce57c8179
parent51ed4fbedf9b26f96bfe09b0997baead8db633c1 (diff)
evas_main: Fix deleting pointer data
This appears to be called from a delete callback that takes place well after the eo parent relationship is deleted, however efl_input_device_get_seat() finds the seat by finding the parent. That will always be NULL during this callback, so we'll leak the data. Instead, search all seats for the pointer.
-rw-r--r--src/lib/evas/canvas/evas_main.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 62b996f6e6..a58f59835c 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -1352,25 +1352,24 @@ _evas_pointer_data_remove(Evas_Public_Data *edata, Efl_Input_Device *pointer)
1352{ 1352{
1353 Evas_Pointer_Data *pdata; 1353 Evas_Pointer_Data *pdata;
1354 Evas_Pointer_Seat *pseat; 1354 Evas_Pointer_Seat *pseat;
1355 Eo *seat; 1355 Evas_Pointer_Seat *hit = NULL;
1356 1356
1357 seat = efl_input_device_seat_get(pointer);
1358 EINA_INLIST_FOREACH(edata->seats, pseat) 1357 EINA_INLIST_FOREACH(edata->seats, pseat)
1359 { 1358 {
1360 if (pseat->seat != seat) continue;
1361 EINA_INLIST_FOREACH(pseat->pointers, pdata) 1359 EINA_INLIST_FOREACH(pseat->pointers, pdata)
1362 if (pdata->pointer == pointer) 1360 if (pdata->pointer == pointer)
1363 { 1361 {
1364 pseat->pointers = eina_inlist_remove(pseat->pointers, EINA_INLIST_GET(pdata)); 1362 pseat->pointers = eina_inlist_remove(pseat->pointers, EINA_INLIST_GET(pdata));
1365 free(pdata); 1363 free(pdata);
1364 hit = pseat;
1366 break; 1365 break;
1367 } 1366 }
1368 if (pseat->pointers) break;
1369 eina_list_free(pseat->object.in);
1370 edata->seats = eina_inlist_remove(edata->seats, EINA_INLIST_GET(pseat));
1371 free(pseat);
1372 break;
1373 } 1367 }
1368 EINA_SAFETY_ON_NULL_RETURN(hit);
1369 if (hit->pointers) return;
1370 eina_list_free(hit->object.in);
1371 edata->seats = eina_inlist_remove(edata->seats, EINA_INLIST_GET(hit));
1372 free(hit);
1374} 1373}
1375 1374
1376Eina_List * 1375Eina_List *