e_comp_wl: fix segfault in case parent's surface is destroyed before subsurface is...
authorBoram Park <boram1288.park@samsung.com>
Tue, 12 May 2015 18:43:00 +0000 (14:43 -0400)
committerChris Michael <cp.michael@samsung.com>
Tue, 12 May 2015 18:43:00 +0000 (14:43 -0400)
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

src/bin/e_comp_wl.c

index 84236f3..6004b72 100644 (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;