Install the bad-alloc handler before fatal errors

The bad-alloc installer was incorrectly asserting that the other handler
isn't set yet, instead of checking its own, but we can avoid that by
changing the order we install them.

Ref: https://github.com/llvm/llvm-project/issues/83040
This commit is contained in:
Josh Stone 2024-03-15 16:49:08 -07:00
parent adf57a75d5
commit 8d374b1f2a

View file

@ -110,8 +110,8 @@ static void BadAllocErrorHandler(void *UserData,
}
extern "C" void LLVMRustInstallErrorHandlers() {
install_fatal_error_handler(FatalErrorHandler);
install_bad_alloc_error_handler(BadAllocErrorHandler);
install_fatal_error_handler(FatalErrorHandler);
install_out_of_memory_new_handler();
}