From b795d36cd3ed308320a86d2185cc328b103905c3 Mon Sep 17 00:00:00 2001 From: John Emmas Date: Tue, 17 Jun 2025 09:02:24 +0100 Subject: [PATCH] Avoid using 'boost::aligned_storage' which is known to be problematic in MSVC builds MS initially believed the runtime issues might be fixable in VS2015 but in fact, Boost's alignment strategy and Microsoft's alignment strategy just turned out to be incompatible:- https://www.boost.org/doc/libs/1_65_0/libs/type_traits/doc/html/boost_typetraits/reference/aligned_storage.html --- libs/pbd/pbd/signals.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libs/pbd/pbd/signals.h b/libs/pbd/pbd/signals.h index e4d3f25272..f1ad3dec58 100644 --- a/libs/pbd/pbd/signals.h +++ b/libs/pbd/pbd/signals.h @@ -439,8 +439,20 @@ SignalWithCombiner::operator() (A... a) PBD::stacktrace (std::cerr, 19); } #endif + +#ifdef _MSC_VER /* Regarding the note (below) it was initially + * thought that the problem got fixed in VS2015 + * but in fact it still persists even in VS2022 */ + /* Use the older (heap based) mapping when building with MSVC. + * Our StackAllocator class depends on 'boost::aligned_storage' + * which is known to be troublesome with Visual C++ :- + * https://www.boost.org/doc/libs/1_65_0/libs/type_traits/doc/html/boost_typetraits/reference/aligned_storage.html + */ + std::vector s; +#else const std::size_t nslots = 512; std::vector > s; +#endif /* First, make a copy of the current connection state for us to iterate * over later (the connection state may be changed by a signal handler.