evas_main: Fix deleting pointer data

Summary:
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.
Depends on D6181

Reviewers: zmike

Reviewed By: zmike

Subscribers: cedric, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6182
This commit is contained in:
Derek Foreman 2018-05-18 13:46:36 -04:00 committed by Mike Blumenkrantz
parent 250b69c239
commit 83e1a456a4
1 changed files with 7 additions and 8 deletions

View File

@ -1352,25 +1352,24 @@ _evas_pointer_data_remove(Evas_Public_Data *edata, Efl_Input_Device *pointer)
{
Evas_Pointer_Data *pdata;
Evas_Pointer_Seat *pseat;
Eo *seat;
Evas_Pointer_Seat *hit = NULL;
seat = efl_input_device_seat_get(pointer);
EINA_INLIST_FOREACH(edata->seats, pseat)
{
if (pseat->seat != seat) continue;
EINA_INLIST_FOREACH(pseat->pointers, pdata)
if (pdata->pointer == pointer)
{
pseat->pointers = eina_inlist_remove(pseat->pointers, EINA_INLIST_GET(pdata));
free(pdata);
hit = pseat;
break;
}
if (pseat->pointers) break;
eina_list_free(pseat->object.in);
edata->seats = eina_inlist_remove(edata->seats, EINA_INLIST_GET(pseat));
free(pseat);
break;
}
EINA_SAFETY_ON_NULL_RETURN(hit);
if (hit->pointers) return;
eina_list_free(hit->object.in);
edata->seats = eina_inlist_remove(edata->seats, EINA_INLIST_GET(hit));
free(hit);
}
Eina_List *