e_service_indicator: use e_client_destroy_listener_add 68/322168/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 3 Apr 2025 10:15:08 +0000 (19:15 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 4 Apr 2025 06:24:34 +0000 (15:24 +0900)
use destroy signal of e_client instead of E_CLIENT_HOOK_DEL.

Change-Id: I0bf55a046202ef23c30b3a2d14468b8ce2e8495d

src/bin/windowmgr/services/e_service_indicator.c

index e75376a9c0b24055297bc6890f8803befc4bfcf9..18b0098748cf4571ecd59282b9f3a29ec3df0a61 100644 (file)
@@ -5,10 +5,10 @@
 
 static E_Client *_ind_server = NULL;
 static E_Client *_ind_owner = NULL;
+static struct wl_listener _ind_client_destroy_listener;
 
 /* event handler */
 static Eina_List *_ind_handlers = NULL;
-static Eina_List *_ind_hooks = NULL;
 static int _ind_angle = -1;
 
 static Eina_Bool
@@ -63,19 +63,15 @@ _indicator_client_unset(void)
    E_FREE_LIST(_ind_handlers, ecore_event_handler_del);
    _ind_handlers = NULL;
 
-   E_FREE_LIST(_ind_hooks, e_client_hook_del);
-   _ind_hooks = NULL;
+   wl_list_remove(&_ind_client_destroy_listener.link);
+   _ind_client_destroy_listener.notify = NULL; /* hack to prevent double free */
 
    _ind_server = NULL;
 }
 
 static void
-_indicator_cb_client_del(void *d EINA_UNUSED, E_Client *ec)
+_indicator_cb_client_destroy(struct wl_listener *listener, void *data)
 {
-   EINA_SAFETY_ON_NULL_RETURN(ec);
-
-   if (_ind_server != ec) return;
-
    _indicator_client_unset();
 }
 
@@ -106,7 +102,10 @@ e_mod_indicator_client_set(E_Client *ec)
    E_LIST_HANDLER_APPEND(_ind_handlers, E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN, _indicator_cb_rot_begin, NULL);
    E_LIST_HANDLER_APPEND(_ind_handlers, E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL, _indicator_cb_rot_done, NULL);
    E_LIST_HANDLER_APPEND(_ind_handlers, E_EVENT_CLIENT_ROTATION_CHANGE_END, _indicator_cb_rot_done, NULL);
-   E_LIST_HOOK_APPEND(_ind_hooks, E_CLIENT_HOOK_DEL, _indicator_cb_client_del, NULL);
+
+   // e_client listeners
+   _ind_client_destroy_listener.notify = _indicator_cb_client_destroy;
+   e_client_destroy_listener_add(ec, &_ind_client_destroy_listener);
 
    _ind_server = ec;
    if (!_ind_owner)