diff options
| author | Martin Hořeňovský | 2025-11-30 12:56:06 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2025-11-30 14:30:19 +0100 |
| commit | 985a3f44605bf3ee7bd4a0c6129ca69ec53a7ebe (patch) | |
| tree | 45ad4f5e3587018288711564bc9e385b2f3b6cb2 /src/catch2/internal/catch_run_context.cpp | |
| parent | a1faad9315ece8e7146e9d2263ceb3d42ea0619a (diff) | |
| download | catch3-985a3f44605bf3ee7bd4a0c6129ca69ec53a7ebe.tar.gz | |
Fix lazy removal of unscoped messages also removing still valid msgs
Diffstat (limited to 'src/catch2/internal/catch_run_context.cpp')
| -rw-r--r-- | src/catch2/internal/catch_run_context.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index 37045f60..1ecc0644 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -824,6 +824,14 @@ namespace Catch { } void IResultCapture::emplaceUnscopedMessage( MessageBuilder&& builder ) { + // Invalid unscoped messages are lazy cleared. If we have any, + // we have to get rid of them before adding new ones, or the + // delayed clear in assertion handling will erase the valid ones + // as well. + if ( Detail::g_clearMessageScopes ) { + Detail::g_messageScopes.clear(); + Detail::g_clearMessageScopes = false; + } Detail::g_messageScopes.emplace_back( CATCH_MOVE( builder ) ); } |