From e70c63ba8f55e26a81dfe888af0a9bc1340e97cb Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 18 Dec 2015 01:08:14 +0800 Subject: [PATCH] context protocol destroy provide nonnull wsi with context Signed-off-by: Andy Green --- lib/context.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/context.c b/lib/context.c index 83c4fc42..7c73c4b8 100644 --- a/lib/context.c +++ b/lib/context.c @@ -253,6 +253,7 @@ LWS_VISIBLE void lws_context_destroy(struct lws_context *context) { const struct lws_protocols *protocol = NULL; + struct lws wsi; int n; lwsl_notice("%s\n", __func__); @@ -260,6 +261,9 @@ lws_context_destroy(struct lws_context *context) if (!context) return; + memset(&wsi, 0, sizeof(wsi)); + wsi.context = context; + #ifdef LWS_LATENCY if (context->worst_latency_info[0]) lwsl_notice("Worst latency: %s\n", context->worst_latency_info); @@ -292,7 +296,7 @@ lws_context_destroy(struct lws_context *context) protocol = context->protocols; if (protocol) { while (protocol->callback) { - protocol->callback(NULL, + protocol->callback(&wsi, LWS_CALLBACK_PROTOCOL_DESTROY, NULL, NULL, 0); protocol++;