From: Vincent Pit Date: Tue, 14 Apr 2015 14:46:12 +0000 (-0300) Subject: Make sure the load refcount is reset on global setup X-Git-Tag: v0.57~8 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=8c151d16f3a7a40201fab13e4fb92433eb6f9c7c;p=perl%2Fmodules%2FVariable-Magic.git Make sure the load refcount is reset on global setup --- diff --git a/Magic.xs b/Magic.xs index 207fcb3..947ae72 100644 --- a/Magic.xs +++ b/Magic.xs @@ -1881,12 +1881,14 @@ static void vmg_setup(pTHX) { #if VMG_THREADSAFE VMG_LOADED_LOCK; - if (vmg_loaded <= 0) { - assert(vmg_loaded == 0); + if (vmg_loaded == 0) { MUTEX_INIT(&vmg_vtable_refcount_mutex); MUTEX_INIT(&vmg_op_name_init_mutex); + vmg_loaded = 1; + } else { + assert(vmg_loaded > 0); + ++vmg_loaded; } - ++vmg_loaded; VMG_LOADED_UNLOCK; #endif