From 5eb38312bd754f8542889f12786ee81a297c13f1 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 8 Oct 2015 01:41:34 +0200 Subject: [PATCH] Work around a crash caused by GC. --- theme.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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; } -- 2.39.2