Do not set wxSetAssertHandler on non-debug builds.
Fixes lp:1809622 https://bugs.launchpad.net/kicad/+bug/1809622
This commit is contained in:
parent
e7fa02a9f0
commit
69d90a4e84
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2014-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -56,7 +56,8 @@ using KIGFX::COLOR4D;
|
|||
|
||||
COLOR4D g_GhostColor;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#if defined( _WIN32 ) && defined( DEBUG )
|
||||
// a wxAssertHandler_t function to filter wxWidgets alert messages when reading/writing a file
|
||||
// when switching the locale to LC_NUMERIC, "C"
|
||||
// It is used in class LOCALE_IO to hide a useless (in kicad) wxWidgets alert message
|
||||
|
@ -69,7 +70,9 @@ void KiAssertFilter( const wxString &file, int line,
|
|||
}
|
||||
#endif
|
||||
|
||||
std::atomic<unsigned int> LOCALE_IO::m_c_count(0);
|
||||
|
||||
std::atomic<unsigned int> LOCALE_IO::m_c_count( 0 );
|
||||
|
||||
|
||||
// Note on Windows, setlocale( LC_NUMERIC, "C" ) works fine to read/write
|
||||
// files with floating point numbers, but generates a overzealous wx alert
|
||||
|
@ -83,7 +86,7 @@ LOCALE_IO::LOCALE_IO()
|
|||
{
|
||||
// Store the user locale name, to restore this locale later, in dtor
|
||||
m_user_locale = setlocale( LC_NUMERIC, nullptr );
|
||||
#ifdef _WIN32
|
||||
#if defined( _WIN32 ) && defined( DEBUG )
|
||||
// Disable wxWidgets alerts
|
||||
wxSetAssertHandler( KiAssertFilter );
|
||||
#endif
|
||||
|
@ -100,7 +103,7 @@ LOCALE_IO::~LOCALE_IO()
|
|||
{
|
||||
// revert to the user locale
|
||||
setlocale( LC_NUMERIC, m_user_locale.c_str() );
|
||||
#ifdef _WIN32
|
||||
#if defined( _WIN32 ) && defined( DEBUG )
|
||||
// Enaable wxWidgets alerts
|
||||
wxSetDefaultAssertHandler();
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue