From 5d8ca8f6d21dec36d622a9da90ea7d6eebb5bbe5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Mon, 18 Dec 2017 12:25:59 +0900 Subject: [PATCH] ecore_con: Make sure the proxy helper is valid If the http proxy helper gets deleted at shutdown rather than because the process actually exited, the object pointer becomes invalid. This patch tries to avoid a situation where the object is not valid. --- src/lib/ecore_con/ecore_con_proxy_helper.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/ecore_con/ecore_con_proxy_helper.c b/src/lib/ecore_con/ecore_con_proxy_helper.c index c313b4d..f99c7a2 100644 --- a/src/lib/ecore_con/ecore_con_proxy_helper.c +++ b/src/lib/ecore_con/ecore_con_proxy_helper.c @@ -53,6 +53,16 @@ static int locks = 0; #endif static void +_efl_net_proxy_helper_delete_cb(void *data EINA_UNUSED, const Efl_Event *ev) +{ + if (ev->object == _efl_net_proxy_helper_exe) + { + INF("HTTP proxy helper object died before the process exited."); + _efl_net_proxy_helper_exe = NULL; + } +} + +static void _efl_net_proxy_helper_spawn(void) { char buf[PATH_MAX]; @@ -102,6 +112,8 @@ _efl_net_proxy_helper_spawn(void) locks--; } eina_spinlock_release(&_efl_net_proxy_helper_queue_lock); + efl_event_callback_add(_efl_net_proxy_helper_exe, EFL_EVENT_DEL, + _efl_net_proxy_helper_delete_cb, NULL); } static void -- 2.7.4