e_comp_wl: fix segfault in case parent's surface is destroyed before subsurface is destroyed

Summary:
A parent surface can be destroyed. In this case, ec->comp_data->sub.data->parent has
a wrong address which has already destroyed. Then, it occurs segmentation fault.
To avoid segfault, ec->comp_data->sub.data->parent should be NULL when a parent surface
is destroyed.

Signed-off-by: Boram Park <boram1288.park@samsung.com>

Test Plan: Run attached test program(subsurface)

Reviewers: gwanglim, cedric, devilhorns, zmike

Reviewed By: devilhorns, zmike

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2484
This commit is contained in:
Boram Park 2015-05-12 14:43:00 -04:00 committed by Chris Michael
parent 82116f63ab
commit 7a078ba99b
1 changed files with 5 additions and 0 deletions

View File

@ -2027,6 +2027,7 @@ _e_comp_wl_client_cb_del(void *data EINA_UNUSED, E_Client *ec)
{
/* Eina_Rectangle *dmg; */
struct wl_resource *cb;
E_Client *subc;
/* make sure this is a wayland client */
if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return;
@ -2041,6 +2042,10 @@ _e_comp_wl_client_cb_del(void *data EINA_UNUSED, E_Client *ec)
e_pixmap_parent_window_set(ec->pixmap, 0);
}
/* remove sub list */
EINA_LIST_FREE(ec->comp_data->sub.list, subc)
subc->comp_data->sub.data->parent = NULL;
if ((ec->parent) && (ec->parent->modal == ec))
{
ec->parent->lock_close = EINA_FALSE;