Add a system option to exit immediately on assert failure.
This option will allow to test for absence of asserts in wxWidgets samples in the future. Closes #10697. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -28,6 +28,17 @@
|
|||||||
|
|
||||||
These options are currently recognised by wxWidgets:
|
These options are currently recognised by wxWidgets:
|
||||||
|
|
||||||
|
@section sysopt_all All platforms
|
||||||
|
|
||||||
|
@beginFlagTable
|
||||||
|
@flag{exit-on-assert}
|
||||||
|
If set to non-zero value, abort the program if an assertion fails. The
|
||||||
|
default behaviour in case of assertion failure depends on the build mode
|
||||||
|
and can be changed by overriding wxApp::OnAssertFailure() but setting
|
||||||
|
this option allows to change it without modifying the program code and
|
||||||
|
also applies to asserts which may happen before the wxApp object
|
||||||
|
creation or after its destruction.
|
||||||
|
@endFlagTable
|
||||||
|
|
||||||
@section sysopt_win Windows
|
@section sysopt_win Windows
|
||||||
|
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
#include "wx/filename.h"
|
#include "wx/filename.h"
|
||||||
#include "wx/msgout.h"
|
#include "wx/msgout.h"
|
||||||
#include "wx/scopedptr.h"
|
#include "wx/scopedptr.h"
|
||||||
|
#include "wx/sysopt.h"
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
#include "wx/thread.h"
|
#include "wx/thread.h"
|
||||||
|
|
||||||
@@ -1027,6 +1028,10 @@ wxDefaultAssertHandler(const wxString& file,
|
|||||||
const wxString& cond,
|
const wxString& cond,
|
||||||
const wxString& msg)
|
const wxString& msg)
|
||||||
{
|
{
|
||||||
|
// If this option is set, we should abort immediately when assert happens.
|
||||||
|
if ( wxSystemOptions::GetOptionInt("exit-on-assert") )
|
||||||
|
abort();
|
||||||
|
|
||||||
// FIXME MT-unsafe
|
// FIXME MT-unsafe
|
||||||
static int s_bInAssert = 0;
|
static int s_bInAssert = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user