From af0aa7904a182951b47eae744d4f7792a175ce03 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Thu, 1 Nov 2018 21:35:35 -0300 Subject: [PATCH] Fix lua scripts with low-priority Close Context --- plugins/lua/lua.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index 0903ec07..56b97708 100644 --- a/plugins/lua/lua.c +++ b/plugins/lua/lua.c @@ -404,6 +404,12 @@ static int api_hexchat_hook_print(lua_State *L) lua_pushvalue(L, 2); ref = luaL_ref(L, LUA_REGISTRYINDEX); pri = luaL_optinteger(L, 3, HEXCHAT_PRI_NORM); + /* we rely on Close Context pri=INT_MIN for internal stuff. this avoids issues. */ + if (pri == INT_MIN && strcmp(event, "Close Context")) + { + hexchat_print(ph, "Warning: Attempted to hook Close Context with priority INT_MIN. Adjusting to INT_MIN+1."); + pri = INT_MIN + 1; + } info = g_new(hook_info, 1); info->state = L; info->ref = ref;