From 7de367a9447ee17108887d10f0f5373560af32f0 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 12 Jun 2023 08:24:36 +0200 Subject: [PATCH] impr: Properly allow multi-threaded logging without messing up output --- lib/libimhex/include/hex/helpers/logger.hpp | 3 +++ plugins/builtin/source/content/views/view_pattern_editor.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libimhex/include/hex/helpers/logger.hpp b/lib/libimhex/include/hex/helpers/logger.hpp index 69e07fc60..0341caecc 100644 --- a/lib/libimhex/include/hex/helpers/logger.hpp +++ b/lib/libimhex/include/hex/helpers/logger.hpp @@ -36,6 +36,9 @@ namespace hex::log { [[maybe_unused]] void print(const fmt::text_style &ts, const std::string &level, const std::string &fmt, auto... args) { auto dest = getDestination(); + static std::mutex loggerMutex; + std::scoped_lock lock(loggerMutex); + printPrefix(dest, ts, level); fmt::print(dest, fmt::runtime(fmt), args...); fmt::print(dest, "\n"); diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index ed4756de5..2e5439907 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -540,7 +540,7 @@ namespace hex::plugin::builtin { auto &runtime = ContentRegistry::PatternLanguage::getRuntime(); auto &evaluator = runtime.getInternals().evaluator; - if (ImGui::BeginChild("##debugger", size, true, ImGuiWindowFlags_AlwaysVerticalScrollbar)) { + if (ImGui::BeginChild("##debugger", size, true)) { const auto &breakpoints = evaluator->getBreakpoints(); auto line = this->m_textEditor.GetCursorPosition().mLine + 1;