From 03990ee7e024b06be06cc32fc0b0a00a2d4946a7 Mon Sep 17 00:00:00 2001 From: Mark Roszko Date: Tue, 13 Jun 2023 13:04:37 +0000 Subject: [PATCH] Move the custom assert handler to release builds only --- common/single_top.cpp | 4 +++- kicad/kicad.cpp | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/single_top.cpp b/common/single_top.cpp index 9d1ed90cf1..465b73a9b0 100644 --- a/common/single_top.cpp +++ b/common/single_top.cpp @@ -133,6 +133,7 @@ private: }; wxIMPLEMENT_DYNAMIC_CLASS(HtmlModule, wxModule); +#ifdef NDEBUG // Define a custom assertion handler void CustomAssertHandler(const wxString& file, int line, @@ -142,6 +143,7 @@ void CustomAssertHandler(const wxString& file, { Pgm().HandleAssert( file, line, func, cond, msg ); } +#endif /** * Struct APP_SINGLE_TOP @@ -162,9 +164,9 @@ struct APP_SINGLE_TOP : public wxApp #ifdef NDEBUG // These checks generate extra assert noise wxSizerFlags::DisableConsistencyChecks(); -#endif wxDISABLE_DEBUG_SUPPORT(); wxSetAssertHandler( CustomAssertHandler ); +#endif // Perform platform-specific init tasks if( !KIPLATFORM::APP::Init() ) diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index 3d6f6f5553..48b41e33f7 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -406,7 +406,7 @@ void PGM_KICAD::Destroy() KIWAY Kiway( &Pgm(), KFCTL_CPP_PROJECT_SUITE ); - +#ifdef NDEBUG // Define a custom assertion handler void CustomAssertHandler(const wxString& file, int line, @@ -416,6 +416,7 @@ void CustomAssertHandler(const wxString& file, { Pgm().HandleAssert( file, line, func, cond, msg ); } +#endif /** * Not publicly visible because most of the action is in #PGM_KICAD these days. @@ -434,9 +435,9 @@ struct APP_KICAD : public wxApp #ifdef NDEBUG // These checks generate extra assert noise wxSizerFlags::DisableConsistencyChecks(); -#endif wxDISABLE_DEBUG_SUPPORT(); wxSetAssertHandler( CustomAssertHandler ); +#endif // Perform platform-specific init tasks if( !KIPLATFORM::APP::Init() )