X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=blobdiff_plain;f=indirect.xs;h=ba0543dae7e778c864bac2a9543479f2a2317e53;hp=0de84e5fba5a465f29166e1270f910b236f8e517;hb=f005f899e4ca83b205bf4cfb37e5d7c56b5d2b4b;hpb=b58bc186ae53367c8df3b55e162f101c8e102a8d diff --git a/indirect.xs b/indirect.xs index 0de84e5..ba0543d 100644 --- a/indirect.xs +++ b/indirect.xs @@ -214,7 +214,7 @@ static void indirect_ck_restore(pTHX_ OPCODE type, indirect_ck_t *old_ck_p) { /* ... Check if the module is loaded ....................................... */ -static U32 indirect_loaded = 0; +static I32 indirect_loaded = 0; #if I_THREADSAFE @@ -246,6 +246,7 @@ static int indirect_set_loaded_locked(pTHX_ void *cxt) { int global_setup = 0; if (indirect_loaded <= 0) { + assert(indirect_loaded == 0); assert(!indirect_loaded_cxts); indirect_loaded_cxts = ptable_new(); global_setup = 1; @@ -266,6 +267,7 @@ static int indirect_clear_loaded_locked(pTHX_ void *cxt) { ptable_loaded_delete(indirect_loaded_cxts, cxt); --indirect_loaded; } else if (indirect_loaded_cxts) { + assert(indirect_loaded == 1); ptable_loaded_free(indirect_loaded_cxts); indirect_loaded_cxts = NULL; indirect_loaded = 0; @@ -1065,6 +1067,9 @@ static void indirect_teardown(pTHX_ void *interp) { I_LOADED_UNLOCK; + SvREFCNT_dec(MY_CXT.global_code); + MY_CXT.global_code = NULL; + ptable_free(MY_CXT.map); MY_CXT.map = NULL;