From 426d8e08d77ce74f9bf45036de0d4b7355384a39 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 5 May 2014 21:18:28 -0400 Subject: [PATCH] Catch moar crashes... ... Instead of throwing up a useless VC++ dialog box, actually do our error handling. --- .../FeatureLib/pfCrashHandler/plCrashCli.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Sources/Plasma/FeatureLib/pfCrashHandler/plCrashCli.cpp b/Sources/Plasma/FeatureLib/pfCrashHandler/plCrashCli.cpp index fc0fea95..2c8cc4d1 100644 --- a/Sources/Plasma/FeatureLib/pfCrashHandler/plCrashCli.cpp +++ b/Sources/Plasma/FeatureLib/pfCrashHandler/plCrashCli.cpp @@ -45,6 +45,21 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifdef HS_BUILD_FOR_WIN32 +#ifdef _MSC_VER +#include + +static void IInvalidParameter(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t) +{ + __debugbreak(); +} + +static void IPureVirtualCall() +{ + __debugbreak(); +} + +#endif // _MSC_VER + plCrashCli::plCrashCli() : fLink(nil), fLinkH(nil) { @@ -96,6 +111,14 @@ plCrashCli::plCrashCli() FALSE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS ); + +#ifdef _MSC_VER + // Sigh... The Visual C++ Runtime likes to throw up dialogs sometimes. + // The user cares not about dialogs. We just want to get a minidump... + // See: http://www.altdevblogaday.com/2012/07/20/more-adventures-in-failing-to-crash-properly/ + _set_invalid_parameter_handler(IInvalidParameter); + _set_purecall_handler(IPureVirtualCall); +#endif // _MSC_VER } plCrashCli::~plCrashCli()