Don't destroy ev/uv loops if they haven't been created yet
authorAlex Hultman <alexhultman@localhost.localdomain>
Sat, 20 Feb 2016 10:58:49 +0000 (11:58 +0100)
committerAndy Green <andy.green@linaro.org>
Sat, 20 Feb 2016 11:35:33 +0000 (19:35 +0800)
lib/libev.c
lib/libuv.c

index 40db6ed..43c53d9 100644 (file)
@@ -138,6 +138,9 @@ lws_libev_destroyloop(struct lws_context *context, int tsi)
        if (!(context->options & LWS_SERVER_OPTION_LIBEV))
                return;
 
+       if (!pt->io_loop_ev)
+               return;
+
        ev_io_stop(pt->io_loop_ev, &pt->w_accept.ev_watcher);
        if (context->use_ev_sigint)
                ev_signal_stop(pt->io_loop_ev,
index e3d68c6..461dc3e 100644 (file)
@@ -124,6 +124,9 @@ lws_libuv_destroyloop(struct lws_context *context, int tsi)
        if (!(context->options & LWS_SERVER_OPTION_LIBUV))
                return;
 
+       if (!pt->io_loop_uv)
+               return;
+
        if (context->use_ev_sigint)
                uv_signal_stop(&pt->w_sigint.uv_watcher);
        for (m = 0; m < ARRAY_SIZE(sigs); m++)