Initialize ReusableStringStream cache before user threads can run

The initialization itself is thread unsafe, and as such we cannot
allow it to be delayed until multiple user-spawned threads need it.
This commit is contained in:
Martin Hořeňovský
2025-11-30 21:34:24 +01:00
parent 5e44382423
commit d26f763180

View File

@@ -210,6 +210,13 @@ namespace Catch {
{ {
getCurrentMutableContext().setResultCapture( this ); getCurrentMutableContext().setResultCapture( this );
m_reporter->testRunStarting(m_runInfo); m_reporter->testRunStarting(m_runInfo);
// TODO: HACK!
// We need to make sure the underlying cache is initialized
// while we are guaranteed to be running in a single thread,
// because the initialization is not thread-safe.
ReusableStringStream rss;
(void)rss;
} }
RunContext::~RunContext() { RunContext::~RunContext() {