aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-08 15:25:11 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-08 16:00:01 -0200
commit17e0204ab334494e051a52435687390375634e69 (patch)
tree81b3526f159067a2da13696469243075738bcb20
parentefl_net_ssl_context: check and document constructor only properties. (diff)
downloadefl-17e0204ab334494e051a52435687390375634e69.tar.gz
efl_net_server_ssl: monitor context del and unref on destructor.
we're leaking ssl_ctx on destruction, also monitor it so we don't access stale data.
-rw-r--r--src/lib/ecore_con/efl_net_server_ssl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/ecore_con/efl_net_server_ssl.c b/src/lib/ecore_con/efl_net_server_ssl.c
index 91810ea448..1fe34bc949 100644
--- a/src/lib/ecore_con/efl_net_server_ssl.c
+++ b/src/lib/ecore_con/efl_net_server_ssl.c
@@ -150,6 +150,14 @@ _efl_net_server_ssl_efl_object_constructor(Eo *o, Efl_Net_Server_Ssl_Data *pd)
return o;
}
+static void
+_efl_net_server_ssl_ctx_del(void *data, const Efl_Event *event EINA_UNUSED)
+{
+ Eo *o = data;
+ Efl_Net_Server_Ssl_Data *pd = efl_data_scope_get(o, MY_CLASS);
+ pd->ssl_ctx = NULL;
+}
+
EOLIAN void
_efl_net_server_ssl_efl_object_destructor(Eo *o, Efl_Net_Server_Ssl_Data *pd)
{
@@ -159,6 +167,13 @@ _efl_net_server_ssl_efl_object_destructor(Eo *o, Efl_Net_Server_Ssl_Data *pd)
pd->server = NULL;
}
+ if (pd->ssl_ctx)
+ {
+ efl_event_callback_del(pd->ssl_ctx, EFL_EVENT_DEL, _efl_net_server_ssl_ctx_del, o);
+ efl_unref(pd->ssl_ctx);
+ pd->ssl_ctx = NULL;
+ }
+
efl_destructor(efl_super(o, MY_CLASS));
}
@@ -170,6 +185,8 @@ _efl_net_server_ssl_ssl_context_set(Eo *o EINA_UNUSED, Efl_Net_Server_Ssl_Data *
if (pd->ssl_ctx == ssl_ctx) return;
efl_unref(pd->ssl_ctx);
pd->ssl_ctx = efl_ref(ssl_ctx);
+ if (ssl_ctx)
+ efl_event_callback_add(ssl_ctx, EFL_EVENT_DEL, _efl_net_server_ssl_ctx_del, o);
}
EOLIAN static Eo *