From 49a035b16061cb906e2efe5ccf9fc66299e64c7a Mon Sep 17 00:00:00 2001 From: Romain BOULLARD Date: Sun, 29 Mar 2026 12:27:44 +0200 Subject: [PATCH] Fix ASAN error --- Bin2CPP/Sources/Bin2CPPLib/Include/Log.hpp | 14 ++++++++++---- Bin2CPP/Sources/Bin2CPPLib/Log.cpp | 2 ++ ConanProfiles/clang | 2 +- ConanProfiles/clang_coverage | 4 ++-- ConanProfiles/clangd | 2 +- ConanProfiles/clangd_asan | 4 ++-- ConanProfiles/msvc | 2 +- ConanProfiles/msvcd | 2 +- ConanProfiles/msvcd_asan | 8 ++++---- 9 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Bin2CPP/Sources/Bin2CPPLib/Include/Log.hpp b/Bin2CPP/Sources/Bin2CPPLib/Include/Log.hpp index d9a3ab2..956b409 100644 --- a/Bin2CPP/Sources/Bin2CPPLib/Include/Log.hpp +++ b/Bin2CPP/Sources/Bin2CPPLib/Include/Log.hpp @@ -62,18 +62,24 @@ class Log #define BIN2CPP_LOG_DEBUG(fmt, ...) \ do \ { \ - if (quill::Logger* logger = Bin2CPP::Singleton::Instance().GetLogger()) \ + if (Bin2CPP::Singleton::HasInstance()) \ { \ - QUILL_LOG_DEBUG(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \ + if (quill::Logger* logger = Bin2CPP::Singleton::Instance().GetLogger()) \ + { \ + QUILL_LOG_DEBUG(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \ + } \ } \ } while (0) #define BIN2CPP_LOG_TRACE(fmt, ...) \ do \ { \ - if (quill::Logger* logger = Bin2CPP::Singleton::Instance().GetLogger()) \ + if (Bin2CPP::Singleton::HasInstance()) \ { \ - QUILL_LOG_TRACE_L3(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \ + if (quill::Logger* logger = Bin2CPP::Singleton::Instance().GetLogger()) \ + { \ + QUILL_LOG_TRACE_L3(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \ + } \ } \ } while (0) diff --git a/Bin2CPP/Sources/Bin2CPPLib/Log.cpp b/Bin2CPP/Sources/Bin2CPPLib/Log.cpp index 525a093..fa02a3b 100644 --- a/Bin2CPP/Sources/Bin2CPPLib/Log.cpp +++ b/Bin2CPP/Sources/Bin2CPPLib/Log.cpp @@ -39,6 +39,8 @@ void Log::Flush() Log::~Log() { + Flush(); + for (quill::Logger* logger: quill::Frontend::get_all_loggers()) { quill::Frontend::remove_logger(logger); diff --git a/ConanProfiles/clang b/ConanProfiles/clang index 86ec4bf..fcafdd6 100644 --- a/ConanProfiles/clang +++ b/ConanProfiles/clang @@ -29,4 +29,4 @@ tools.cmake.cmaketoolchain:generator=Ninja !cmake/*: cmake/[>=4.2] [options] -Bin2CPP/*:build_tests=True \ No newline at end of file +bin2cpp/*:build_tests=True \ No newline at end of file diff --git a/ConanProfiles/clang_coverage b/ConanProfiles/clang_coverage index f536fd9..c0f9145 100644 --- a/ConanProfiles/clang_coverage +++ b/ConanProfiles/clang_coverage @@ -26,5 +26,5 @@ tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} !cmake/*: cmake/[>=4.2] [options] -Bin2CPP/*:build_tests=True -Bin2CPP/*:coverage=True +bin2cpp/*:build_tests=True +bin2cpp/*:coverage=True diff --git a/ConanProfiles/clangd b/ConanProfiles/clangd index 0fa3339..8eedbaf 100644 --- a/ConanProfiles/clangd +++ b/ConanProfiles/clangd @@ -26,4 +26,4 @@ tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} !cmake/*: cmake/[>=4.2] [options] -Bin2CPP/*:build_tests=True \ No newline at end of file +bin2cpp/*:build_tests=True \ No newline at end of file diff --git a/ConanProfiles/clangd_asan b/ConanProfiles/clangd_asan index 9a8fc1e..a975412 100644 --- a/ConanProfiles/clangd_asan +++ b/ConanProfiles/clangd_asan @@ -29,5 +29,5 @@ tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} !cmake/*: cmake/[>=4.2] [options] -Bin2CPP/*:asan=True -Bin2CPP/*:build_tests=True \ No newline at end of file +bin2cpp/*:asan=True +bin2cpp/*:build_tests=True \ No newline at end of file diff --git a/ConanProfiles/msvc b/ConanProfiles/msvc index 0aafee5..e9c63d6 100644 --- a/ConanProfiles/msvc +++ b/ConanProfiles/msvc @@ -21,4 +21,4 @@ tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Z !cmake/*: cmake/[>=4.2] [options] -Bin2CPP/*:build_tests=True \ No newline at end of file +bin2cpp/*:build_tests=True \ No newline at end of file diff --git a/ConanProfiles/msvcd b/ConanProfiles/msvcd index 9bdcd07..10afcdc 100644 --- a/ConanProfiles/msvcd +++ b/ConanProfiles/msvcd @@ -17,4 +17,4 @@ tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Z !cmake/*: cmake/[>=4.2] [options] -Bin2CPP/*:build_tests=True +bin2cpp/*:build_tests=True diff --git a/ConanProfiles/msvcd_asan b/ConanProfiles/msvcd_asan index d9bb8af..2b8cdca 100644 --- a/ConanProfiles/msvcd_asan +++ b/ConanProfiles/msvcd_asan @@ -14,12 +14,12 @@ tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/msvc_ccache.cmake tools.build:exelinkflags=["/INCREMENTAL:NO"] tools.build:sharedlinkflags=["/INCREMENTAL:NO"] -tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_NAMES=1"] -tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/Zc:throwingNew"] +tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_NAMES=1", "/fsanitize=address"] +tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/Zc:throwingNew", "/fsanitize=address"] [tool_requires] !cmake/*: cmake/[>=4.2] [options] -Bin2CPP/*:asan=True -Bin2CPP/*:build_tests=True +bin2cpp/*:asan=True +bin2cpp/*:build_tests=True