Fix lazy removal of unscoped messages also removing still valid msgs

This commit is contained in:
Martin Hořeňovský
2025-11-30 12:56:06 +01:00
parent a1faad9315
commit 985a3f4460
21 changed files with 222 additions and 18 deletions

View File

@@ -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 ) );
}