From: Seunghun Lee Date: Wed, 14 Oct 2020 04:55:48 +0000 (+0900) Subject: video: Do not free an instance in a handler of removing E_Client. X-Git-Tag: submit/tizen/20201111.090326~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=183902c5699ac78dcccde7435d7fb956752defc0;p=platform%2Fupstream%2Fenlightenment.git video: Do not free an instance in a handler of removing E_Client. Do not free an instance associated with tizen_video_object in a handler of removing E_Client. The instance should be removed with wl_resource. Change-Id: I6d3ac1ab81cc69a3b161415e84de41a20cf0520a --- diff --git a/src/bin/video/e_comp_wl_video.c b/src/bin/video/e_comp_wl_video.c index cbef685cd6..0e340a9deb 100644 --- a/src/bin/video/e_comp_wl_video.c +++ b/src/bin/video/e_comp_wl_video.c @@ -20,7 +20,6 @@ struct _E_Video_Object }; static void _e_comp_wl_video_object_setup(E_Video_Object *vo, E_Client *ec); -static void _e_comp_wl_video_object_destroy(E_Video_Object *vo); static int _e_comp_wl_video_object_prop_id_get(E_Video_Object *vo, const char *name) @@ -54,9 +53,13 @@ _e_comp_wl_video_object_ec_cb_remove(void *data, int type, void *event) ec = ev->ec; vo = data; if (vo->ec != ec) return ECORE_CALLBACK_PASS_ON; - if (!ec->comp_data) return ECORE_CALLBACK_PASS_ON; - _e_comp_wl_video_object_destroy(vo); + E_FREE_FUNC(vo->client_event_handler.visibility_change, ecore_event_handler_del); + E_FREE_FUNC(vo->client_event_handler.remove, ecore_event_handler_del); + + e_client_video_unset(vo->ec); + + vo->ec = NULL; return ECORE_CALLBACK_PASS_ON; } @@ -129,31 +132,21 @@ _e_comp_wl_video_object_setup(E_Video_Object *vo, E_Client *ec) } } -static void -_e_comp_wl_video_object_destroy(E_Video_Object *vo) -{ - if (!vo) - return; - - VIN("destroy", vo->ec); - - wl_resource_set_destructor(vo->resource, NULL); - - E_FREE_FUNC(vo->client_event_handler.visibility_change, ecore_event_handler_del); - E_FREE_FUNC(vo->client_event_handler.remove, ecore_event_handler_del); - - e_client_video_unset(vo->ec); - - free(vo); -} - static void _e_comp_wl_video_object_resource_destroy(struct wl_resource *resource) { E_Video_Object *vo = wl_resource_get_user_data(resource); EINA_SAFETY_ON_NULL_RETURN(vo); - _e_comp_wl_video_object_destroy(vo); + if (vo->ec) + { + E_FREE_FUNC(vo->client_event_handler.visibility_change, ecore_event_handler_del); + E_FREE_FUNC(vo->client_event_handler.remove, ecore_event_handler_del); + + e_client_video_unset(vo->ec); + } + + free(vo); } static void @@ -173,7 +166,6 @@ _e_comp_wl_video_object_handle_attribute_set(struct wl_client *client, int id; vo = wl_resource_get_user_data(resource); - EINA_SAFETY_ON_NULL_RETURN(vo); if (!vo->ec) return; @@ -228,7 +220,6 @@ _e_comp_wl_video_object_handle_topmost_visibility_follow(struct wl_client *clien E_Video_Object *vo; vo = wl_resource_get_user_data(resource); - EINA_SAFETY_ON_NULL_RETURN(vo); if(!vo->ec) return; @@ -253,7 +244,6 @@ _e_comp_wl_video_object_handle_topmost_visibility_unfollow(struct wl_client *cli E_Video_Object *vo; vo = wl_resource_get_user_data(resource); - EINA_SAFETY_ON_NULL_RETURN(vo); if(!vo->ec) return; @@ -271,7 +261,6 @@ _e_comp_wl_video_object_handle_attribute_allowed(struct wl_client *client, E_Video_Object *vo; vo = wl_resource_get_user_data(resource); - EINA_SAFETY_ON_NULL_RETURN(vo); if(!vo->ec) return; @@ -287,7 +276,6 @@ _e_comp_wl_video_object_handle_attribute_disallowed(struct wl_client *client, E_Video_Object *vo; vo = wl_resource_get_user_data(resource); - EINA_SAFETY_ON_NULL_RETURN(vo); if(!vo->ec) return;