e_comp_wl: Add a hook point for destruction of comp_data 75/261075/2
authorSeunghun Lee <shiin.lee@samsung.com>
Fri, 9 Jul 2021 01:39:01 +0000 (10:39 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Mon, 12 Jul 2021 01:14:51 +0000 (10:14 +0900)
This is to add a hook point, E_COMP_WL_HOOK_DEL which will be triggered
right before comp_data gets destroyed.

Many implementations of E20 have referred to ec->comp_data, but there
have been no way to find out when it's deleted.
So, we have had to check the validation of it before accessing it.

Through this patch, we can now ensure the validation of comp_data by
using a handler of E_COMP_WL_HOOK_DEL.

Change-Id: I7485d9b11a1ea46d500b4b0eac165e8529045cae

src/bin/e_comp_wl.c
src/bin/e_comp_wl.h

index bd2201468034db4886c40586124df585e64de5d1..b7cc9972efbb36805689e2ba938e6a310b7467be 100644 (file)
@@ -78,6 +78,7 @@ static Eina_Inlist *_e_comp_wl_hooks[] =
    [E_COMP_WL_HOOK_BUFFER_CHANGE] = NULL,
    [E_COMP_WL_HOOK_CLIENT_REUSE] = NULL,
    [E_COMP_WL_HOOK_BUFFER_SIZE_CHANGE] = NULL,
+   [E_COMP_WL_HOOK_DEL] = NULL,
 };
 
 static Eina_Inlist *_e_comp_wl_pid_hooks[] =
@@ -123,7 +124,8 @@ _e_comp_wl_hook_call(E_Comp_Wl_Hook_Point hookpoint, E_Client *ec)
      {
         if (ch->delete_me) continue;
         ch->func(ch->data, ec);
-        if (e_object_is_del(E_OBJECT(ec)))
+        if ((hookpoint != E_COMP_WL_HOOK_DEL) &&
+            (e_object_is_del(E_OBJECT(ec))))
           break;
      }
    _e_comp_wl_hooks_walking--;
@@ -3602,6 +3604,8 @@ _e_comp_wl_client_cb_del(void *data EINA_UNUSED, E_Client *ec)
 
    TRACE_DS_BEGIN(COMP_WL:CLIENT DEL CB);
 
+   _e_comp_wl_hook_call(E_COMP_WL_HOOK_DEL, ec);
+
    if ((!ec->already_unparented) && (ec->comp_data->reparented))
      _e_comp_wl_focus_down_set(ec);
 
index 169ae0383c83dae8b9399f92ea3a3b0e3ff5284e..31bca8b37e46a2067c619669ee7cfd2ab614dadf 100644 (file)
@@ -63,6 +63,7 @@ typedef enum _E_Comp_Wl_Hook_Point
    E_COMP_WL_HOOK_BUFFER_CHANGE,
    E_COMP_WL_HOOK_CLIENT_REUSE,
    E_COMP_WL_HOOK_BUFFER_SIZE_CHANGE,
+   E_COMP_WL_HOOK_DEL,
    E_COMP_WL_HOOK_LAST,
 } E_Comp_Wl_Hook_Point;