fix: thread safe access to log file

This commit is contained in:
FutureRave 2023-01-29 16:20:37 +00:00
parent f6321f8e54
commit 815ebbdefa
No known key found for this signature in database
GPG Key ID: 22F9079C86CFAB31
2 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,8 @@
#include "log_file.hpp"
#include "file_system.hpp"
#include "console.hpp"
std::mutex log_file::log_file_mutex;
const char* log_file::log_file_name;
@ -68,6 +69,8 @@ void log_file::com_log_print_message(const std::string& msg)
void log_file::info(const std::string& msg)
{
std::lock_guard _(log_file_mutex);
if (com_logfile && com_logfile->current.integer)
{
com_log_print_message(msg);

View File

@ -12,6 +12,7 @@ public:
static const game::native::dvar_t* com_logfile;
private:
static std::mutex log_file_mutex;
static const char* log_file_name;
static int opening_qconsole;