aboutsummaryrefslogtreecommitdiff
path: root/src/script/common
diff options
context:
space:
mode:
authorHybridDog <3192173+HybridDog@users.noreply.github.com>2020-04-22 00:07:12 +0200
committerGitHub <noreply@github.com>2020-04-22 00:07:12 +0200
commit4361bfcb4da0b6f9de74c7de9f2d08084877713e (patch)
treebf2dd19f35560aecdc8c63457b885b18a73a9aeb /src/script/common
parent8ef239b448c52485cf94d334c1d8b1c6de37d976 (diff)
downloadhax-minetest-server-4361bfcb4da0b6f9de74c7de9f2d08084877713e.tar.gz
hax-minetest-server-4361bfcb4da0b6f9de74c7de9f2d08084877713e.zip
Fix configuration caching in log_deprecated (#9697)
* Fix configuration caching in log_deprecated The configured variable was never set to true. I've set the variables to thread_local because the configuration should be reloaded after reentering the world from mainmenu.
Diffstat (limited to 'src/script/common')
-rw-r--r--src/script/common/c_internal.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/script/common/c_internal.cpp b/src/script/common/c_internal.cpp
index b19af9f82..6df1f8b7b 100644
--- a/src/script/common/c_internal.cpp
+++ b/src/script/common/c_internal.cpp
@@ -157,9 +157,9 @@ static void script_log(lua_State *L, const std::string &message,
void log_deprecated(lua_State *L, const std::string &message, int stack_depth)
{
- static bool configured = false;
- static bool do_log = false;
- static bool do_error = false;
+ static thread_local bool configured = false;
+ static thread_local bool do_log = false;
+ static thread_local bool do_error = false;
// Only read settings on first call
if (!configured) {
@@ -167,9 +167,10 @@ void log_deprecated(lua_State *L, const std::string &message, int stack_depth)
if (value == "log") {
do_log = true;
} else if (value == "error") {
- do_log = true;
+ do_log = true;
do_error = true;
}
+ configured = true;
}
if (do_log)