From 69d90a4e84c1c904c0d880d431a7aebfa991994d Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 15 Jan 2019 09:29:33 -0500 Subject: [PATCH] Do not set wxSetAssertHandler on non-debug builds. Fixes lp:1809622 https://bugs.launchpad.net/kicad/+bug/1809622 --- common/common.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/common/common.cpp b/common/common.cpp index ac870a43cb..497e3a806e 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2014-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * 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 LOCALE_IO::m_c_count(0); + +std::atomic 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