Skip to content

Commit 5713b2d

Browse files
committed
fix(core): fixed crash on run.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
1 parent 1b6890b commit 5713b2d

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

Lib/core/ctx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ void inline ctx_logger(const m_ctx_t *c, const m_mod_t *mod, const char *fmt, ..
399399

400400
_public_ m_ctx_t *m_ctx(void) {
401401
m_ctx_t *c = pthread_getspecific(key);
402-
if (c->curr_mod) {
402+
if (c && c->curr_mod) {
403403
M_RET_ASSERT(!(c->curr_mod->flags & M_MOD_DENY_CTX), NULL);
404404
}
405405
return c;

Lib/core/public/module/mod_easy.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@
1010
* ctors order:
1111
* 0) each m_mod_on_boot() (only mod_easy API)
1212
* 1) each m_mod_ctor() (only mod_easy API)
13-
*
14-
* dtors order:
15-
* 0) each m_mod_dtor() (only mod_easy API)
1613
*/
1714
#define _m_ctor0_ __attribute__((constructor (111)))
1815
#define _m_ctor1_ __attribute__((constructor (112)))
19-
#define _m_dtor0_ __attribute__((destructor (111)))
2016

2117
/* Simple macro to automatically manage module lifecycle and callbacks */
2218
#define M_MOD(name) \
@@ -33,7 +29,4 @@
3329
m_mod_hook_t hook = { m_mod_on_start, m_mod_on_eval, m_mod_on_evt, m_mod_on_stop }; \
3430
m_mod_register(name, _m_ctx, NULL , &hook, M_MOD_PERSIST, NULL); \
3531
} \
36-
static void _m_dtor0_ m_mod_dtor(void) { \
37-
m_mem_unrefp((void **)&_m_ctx); \
38-
} \
3932
static void _m_ctor0_ m_mod_on_boot(void)

0 commit comments

Comments
 (0)