e_comp_screen: free tzsr object when destroyed 72/159572/1
authorBoram Park <boram1288.park@samsung.com>
Fri, 10 Nov 2017 00:25:33 +0000 (09:25 +0900)
committerBoram Park <boram1288.park@samsung.com>
Fri, 10 Nov 2017 00:29:04 +0000 (09:29 +0900)
Change-Id: I4e92e675a10616dbe9d99a073bf12f81830a599a

src/bin/e_comp_screen.c

index a297172a704fc5976ac4948363c12e4ec59f4748..427b343254da1d40c343c0e511df4647e2f8b47b 100644 (file)
@@ -43,10 +43,25 @@ _tz_surface_rotation_find(E_Client *ec)
    return NULL;
 }
 
+static E_Comp_Screen_Tzsr*
+_tz_surface_rotation_find_with_resource(struct wl_resource *resource)
+{
+   E_Comp_Screen_Tzsr *tzsr;
+   Eina_List *l;
+
+   EINA_LIST_FOREACH(tzsr_list, l, tzsr)
+     {
+        if (tzsr->resource == resource)
+          return tzsr;
+     }
+
+   return NULL;
+}
+
 static void
 _tz_surface_rotation_free(E_Comp_Screen_Tzsr *tzsr)
 {
-   ELOGF("COMP", "|tzsr(%p)", NULL, tzsr->ec, tzsr);
+   ELOGF("TRANSFORM", "|tzsr(%p) freed", NULL, tzsr->ec, tzsr);
    tzsr_list = eina_list_remove(tzsr_list, tzsr);
    free(tzsr);
 }
@@ -103,6 +118,13 @@ static const struct tizen_screen_rotation_interface _tz_screen_rotation_interfac
    _tz_screen_rotation_iface_cb_destroy,
 };
 
+static void _tz_screen_rotation_cb_destroy(struct wl_resource *resource)
+{
+   E_Comp_Screen_Tzsr *tzsr = _tz_surface_rotation_find_with_resource(resource);
+   if (!tzsr) return;
+   _tz_surface_rotation_free(tzsr);
+}
+
 static void
 _tz_screen_rotation_cb_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
 {
@@ -115,7 +137,7 @@ _tz_screen_rotation_cb_bind(struct wl_client *client, void *data, uint32_t versi
         return;
      }
 
-   wl_resource_set_implementation(res, &_tz_screen_rotation_interface, NULL, NULL);
+   wl_resource_set_implementation(res, &_tz_screen_rotation_interface, NULL, _tz_screen_rotation_cb_destroy);
 }
 
 static Eldbus_Message *