From ac3391938c697fd41166fd9e41fa0d41c1fbd708 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 23 Feb 2020 23:08:59 +0100 Subject: [PATCH] :Fix module behavior --- src/gwion.c | 10 ++++++---- tests/import/get_module.c | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gwion.c b/src/gwion.c index 1b816c77..df61ac10 100644 --- a/src/gwion.c +++ b/src/gwion.c @@ -74,11 +74,13 @@ ANN static void gwion_core(const Gwion gwion) { ANN static m_bool gwion_ok(const Gwion gwion, Arg* arg) { gwion->data->plug = new_pluginfo(gwion->mp, &arg->lib); shreduler_set_loop(gwion->vm->shreduler, arg->loop); - if(gwion_audio(gwion) > 0 && gwion_engine(gwion)) { - gwion_cleaner(gwion); + if(gwion_audio(gwion) > 0) { plug_run(gwion, &arg->mod); - gwion_compile(gwion, &arg->add); - return GW_OK; + if(gwion_engine(gwion)) { + gwion_cleaner(gwion); + gwion_compile(gwion, &arg->add); + return GW_OK; + } } return GW_ERROR; } diff --git a/tests/import/get_module.c b/tests/import/get_module.c index d0ecf040..d4d11e62 100644 --- a/tests/import/get_module.c +++ b/tests/import/get_module.c @@ -17,15 +17,15 @@ GWMODSTR(dummy_module); GWMODINI(dummy_module) { puts(__func__); - return NULL; + return (void*)2; // we need to return something } GWMODEND(dummy_module) { puts(__func__); } GWION_IMPORT(dummy_module) { - GWI_OB(get_module(gwi->gwion, "dummy_module")) - puts("test passed!"); + CHECK_OB(get_module(gwi->gwion, "dummy_module")) + puts("test passed"); get_module(gwi->gwion, "non_existant_module"); return GW_OK; } -- 2.43.0