diff options
| author | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-02-24 10:13:07 +0100 |
|---|---|---|
| committer | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-02-24 10:13:07 +0100 |
| commit | d2bd8f65c678d898b6b7e5e92f76cb4dcce97b3c (patch) | |
| tree | 5b7af4399e19f81bb15d25a9b1f543fc29a5b56d | |
| parent | c662c34aaf279c9fedd5bee499c57d9986801538 (diff) | |
| download | lanes-d2bd8f65c678d898b6b7e5e92f76cb4dcce97b3c.tar.gz lanes-d2bd8f65c678d898b6b7e5e92f76cb4dcce97b3c.tar.bz2 lanes-d2bd8f65c678d898b6b7e5e92f76cb4dcce97b3c.zip | |
Multi-state initialisation issue
Fix lookup database table not being created when it should if Lanes is
required in more than one Lua master state
| -rw-r--r-- | CHANGES | 3 | ||||
| -rw-r--r-- | src/lanes.c | 14 |
2 files changed, 10 insertions, 7 deletions
| @@ -1,5 +1,8 @@ | |||
| 1 | CHANGES: | 1 | CHANGES: |
| 2 | 2 | ||
| 3 | CHANGE 103: BGe 24-Feb-14 | ||
| 4 | * Fix lookup database table not being created when it should if Lanes is required in more than one Lua master state | ||
| 5 | |||
| 3 | CHANGE 102: BGe 18-Feb-14 | 6 | CHANGE 102: BGe 18-Feb-14 |
| 4 | * raise an error instead of dereferencing a NULL pointer on deep userdata creation and lane struct creation | 7 | * raise an error instead of dereferencing a NULL pointer on deep userdata creation and lane struct creation |
| 5 | 8 | ||
diff --git a/src/lanes.c b/src/lanes.c index d6fe170..9f90ff7 100644 --- a/src/lanes.c +++ b/src/lanes.c | |||
| @@ -3034,10 +3034,6 @@ static int init_once_LOCKED( lua_State* L) | |||
| 3034 | lua_insert( L, -2); // Swap key with the Linda object | 3034 | lua_insert( L, -2); // Swap key with the Linda object |
| 3035 | lua_rawset( L, LUA_REGISTRYINDEX); | 3035 | lua_rawset( L, LUA_REGISTRYINDEX); |
| 3036 | 3036 | ||
| 3037 | // we'll need this every time we transfer some C function from/to this state | ||
| 3038 | lua_newtable( L); | ||
| 3039 | lua_setfield( L, LUA_REGISTRYINDEX, LOOKUP_REGKEY); | ||
| 3040 | |||
| 3041 | STACK_END( L, 0); | 3037 | STACK_END( L, 0); |
| 3042 | return 0; | 3038 | return 0; |
| 3043 | } | 3039 | } |
| @@ -3186,13 +3182,17 @@ LUAG_FUNC( configure) | |||
| 3186 | lua_setfield( L, -2, "require"); // settings M | 3182 | lua_setfield( L, -2, "require"); // settings M |
| 3187 | 3183 | ||
| 3188 | lua_pushstring(L, VERSION); // settings M VERSION | 3184 | lua_pushstring(L, VERSION); // settings M VERSION |
| 3189 | lua_setfield(L, -2, "version"); // settings M | 3185 | lua_setfield( L, -2, "version"); // settings M |
| 3190 | 3186 | ||
| 3191 | lua_pushinteger(L, THREAD_PRIO_MAX); // settings M THREAD_PRIO_MAX | 3187 | lua_pushinteger(L, THREAD_PRIO_MAX); // settings M THREAD_PRIO_MAX |
| 3192 | lua_setfield(L, -2, "max_prio"); // settings M | 3188 | lua_setfield( L, -2, "max_prio"); // settings M |
| 3193 | 3189 | ||
| 3194 | lua_pushlightuserdata( L, CANCEL_ERROR); // settings M CANCEL_ERROR | 3190 | lua_pushlightuserdata( L, CANCEL_ERROR); // settings M CANCEL_ERROR |
| 3195 | lua_setfield(L, -2, "cancel_error"); // settings M | 3191 | lua_setfield( L, -2, "cancel_error"); // settings M |
| 3192 | |||
| 3193 | // we'll need this every time we transfer some C function from/to this state | ||
| 3194 | lua_newtable( L); | ||
| 3195 | lua_setfield( L, LUA_REGISTRYINDEX, LOOKUP_REGKEY); | ||
| 3196 | 3196 | ||
| 3197 | // register all native functions found in that module in the transferable functions database | 3197 | // register all native functions found in that module in the transferable functions database |
| 3198 | // we process it before _G because we don't want to find the module when scanning _G (this would generate longer names) | 3198 | // we process it before _G because we don't want to find the module when scanning _G (this would generate longer names) |
