mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-03 21:49:32 +01:00 
			
		
		
		
	Update to match the latest devel (v3) branch.
This commit is contained in:
		@@ -125,9 +125,11 @@ namespace Catch {
 | 
				
			|||||||
        previousTopLevelExceptionFilter = SetUnhandledExceptionFilter(topLevelExceptionFilter);
 | 
					        previousTopLevelExceptionFilter = SetUnhandledExceptionFilter(topLevelExceptionFilter);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void FatalConditionHandler::disengage_platform() {
 | 
					    void FatalConditionHandler::disengage_platform() noexcept {
 | 
				
			||||||
        if (SetUnhandledExceptionFilter(reinterpret_cast<LPTOP_LEVEL_EXCEPTION_FILTER>(previousTopLevelExceptionFilter)) != topLevelExceptionFilter) {
 | 
					        if (SetUnhandledExceptionFilter(previousTopLevelExceptionFilter) != topLevelExceptionFilter) {
 | 
				
			||||||
            CATCH_RUNTIME_ERROR("Could not restore previous top level exception filter");
 | 
					            Catch::cerr()
 | 
				
			||||||
 | 
					                << "Unexpected SEH unhandled exception filter on disengage."
 | 
				
			||||||
 | 
					                << " The filter was restored, but might be rolled back unexpectedly.";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        previousTopLevelExceptionFilter = nullptr;
 | 
					        previousTopLevelExceptionFilter = nullptr;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -491,9 +491,8 @@ TEMPLATE_TEST_CASE_SIG("#1954 - 7 arg template test case sig compiles", "[regres
 | 
				
			|||||||
    SUCCEED();
 | 
					    SUCCEED();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}} // namespace MiscTests
 | 
					// MinGW doesn't support __try, and Clang has only very partial support
 | 
				
			||||||
 | 
					#if defined(_MSC_VER)
 | 
				
			||||||
#if defined(CATCH_PLATFORM_WINDOWS)
 | 
					 | 
				
			||||||
void throw_and_catch()
 | 
					void throw_and_catch()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    __try {
 | 
					    __try {
 | 
				
			||||||
@@ -522,4 +521,18 @@ TEST_CASE("Validate SEH behavior - unhandled", "[.approvals][FatalConditionHandl
 | 
				
			|||||||
    // Validate that Catch2 framework correctly handles tests raising and not handling SEH exceptions.
 | 
					    // Validate that Catch2 framework correctly handles tests raising and not handling SEH exceptions.
 | 
				
			||||||
    throw_no_catch();
 | 
					    throw_no_catch();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					
 | 
				
			||||||
 | 
					static LONG CALLBACK dummyExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) {
 | 
				
			||||||
 | 
					    return EXCEPTION_CONTINUE_SEARCH;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST_CASE("Validate SEH behavior - no crash for stack unwinding", "[approvals][!throws][!shouldfail][FatalConditionHandler][CATCH_PLATFORM_WINDOWS]")
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    // Trigger stack unwinding with SEH top-level filter changed and validate the test fails expectedly with no application crash
 | 
				
			||||||
 | 
					    SetUnhandledExceptionFilter(dummyExceptionFilter);
 | 
				
			||||||
 | 
					    throw 1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // _MSC_VER
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}} // namespace MiscTests
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user