From 06856ef8b225208a21abf313aaf51905352c6e9d Mon Sep 17 00:00:00 2001 From: benoit-germain Date: Fri, 10 Aug 2012 20:49:54 +0300 Subject: Yet another shutdown crash fix Perform keeper desinit in two stages, in case the keeper state being closed contains a reference to a linda bound to a previously desinitialized keeper, causing it to be destroyed after its keeper state. (occurs only for applications using more than one keeper). --- src/keeper.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/keeper.c b/src/keeper.c index 28dc338..4e2beb7 100644 --- a/src/keeper.c +++ b/src/keeper.c @@ -66,9 +66,13 @@ static int GNbKeepers = 0; static void atexit_close_keepers(void) { int i; + // 2-pass close, in case a keeper holds a reference to a linda bound to another keeoer for( i = 0; i < GNbKeepers; ++ i) { lua_close( GKeepers[i].L); + } + for( i = 0; i < GNbKeepers; ++ i) + { GKeepers[i].L = 0; //assert( GKeepers[i].count == 0); MUTEX_FREE( &GKeepers[i].lock_); -- cgit v1.2.3-55-g6feb