Test cases might set the top level handler multiple times, so we have to allow that

This commit is contained in:
Sebastian Messmer 2018-09-07 04:58:11 -07:00
parent fafbbb8e3a
commit 916632279b

View File

@ -175,11 +175,10 @@ namespace cpputils {
}
void showBacktraceOnCrash() {
if (our_top_level_handler_set) {
throw std::logic_error("showBackraceOnCrash: Our top level handler is already set.");
if (!our_top_level_handler_set) {
previous_top_level_handler = SetUnhandledExceptionFilter(TopLevelExceptionHandler);
our_top_level_handler_set = true;
}
previous_top_level_handler = SetUnhandledExceptionFilter(TopLevelExceptionHandler);
our_top_level_handler_set = true;
}
}