From: Steinar H. Gunderson Date: Wed, 7 Oct 2015 23:41:34 +0000 (+0200) Subject: Work around a crash caused by GC. X-Git-Tag: 1.0.0~271 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=5eb38312bd754f8542889f12786ee81a297c13f1 Work around a crash caused by GC. --- diff --git a/theme.cpp b/theme.cpp index 09797a6..acfb27c 100644 --- a/theme.cpp +++ b/theme.cpp @@ -103,6 +103,11 @@ int EffectChain_add_effect(lua_State* L) } lua_settop(L, 2); // Return the effect itself. + + // Make sure Lua doesn't garbage-collect it away. + lua_pushvalue(L, -1); + luaL_ref(L, LUA_REGISTRYINDEX); // TODO: leak? + return 1; }