Stop using deprecated API for assert output handler

This commit is contained in:
Stefan Csomor
2020-07-10 15:10:59 +02:00
committed by Vadim Zeitlin
parent 74bc9b5f71
commit 065f2a283f

View File

@@ -225,16 +225,14 @@ bool wxApp::OSXOnShouldTerminate()
#if wxDEBUG_LEVEL && wxOSX_USE_COCOA_OR_CARBON #if wxDEBUG_LEVEL && wxOSX_USE_COCOA_OR_CARBON
pascal static void extern "C" void
wxMacAssertOutputHandler(OSType WXUNUSED(componentSignature), wxMacAssertOutputHandler(const char *WXUNUSED(componentName),
UInt32 WXUNUSED(options),
const char *assertionString, const char *assertionString,
const char *exceptionLabelString, const char *exceptionLabelString,
const char *errorString, const char *errorString,
const char *fileName, const char *fileName,
long lineNumber, long lineNumber,
void *value, int errorCode)
ConstStr255Param WXUNUSED(outputMsg))
{ {
// flow into assert handling // flow into assert handling
wxString fileNameStr ; wxString fileNameStr ;
@@ -254,18 +252,18 @@ wxMacAssertOutputHandler(OSType WXUNUSED(componentSignature),
errorStr = (errorString!=0) ? errorString : "" ; errorStr = (errorString!=0) ? errorString : "" ;
#endif #endif
#if 1 // turn this on, if you want the macOS asserts to flow into log, otherwise they are handled via wxOnAssert
// flow into log #if 0
wxLogDebug( wxT("AssertMacros: %s %s %s file: %s, line: %ld (value %p)\n"), wxLogDebug( wxT("AssertMacros: %s %s %s file: %s, line: %ld (error code %d)\n"),
assertionStr.c_str() , assertionStr.c_str() ,
exceptionStr.c_str() , exceptionStr.c_str() ,
errorStr.c_str(), errorStr.c_str(),
fileNameStr.c_str(), lineNumber , fileNameStr.c_str(), lineNumber ,
value ) ; errorCode ) ;
#else #else
wxOnAssert(fileNameStr, lineNumber , assertionStr , wxOnAssert(fileNameStr, lineNumber , assertionStr ,
wxString::Format( wxT("%s %s value (%p)") , exceptionStr, errorStr , value ) ) ; wxString::Format( wxT("%s %s value (%d)") , exceptionStr, errorStr , errorCode ) ) ;
#endif #endif
} }
@@ -273,12 +271,6 @@ wxMacAssertOutputHandler(OSType WXUNUSED(componentSignature),
bool wxApp::Initialize(int& argc, wxChar **argv) bool wxApp::Initialize(int& argc, wxChar **argv)
{ {
// Mac-specific
#if wxDEBUG_LEVEL && wxOSX_USE_COCOA_OR_CARBON
InstallDebugAssertOutputHandler( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) );
#endif
/* /*
Cocoa supports -Key value options which set the user defaults key "Key" Cocoa supports -Key value options which set the user defaults key "Key"
to the value "value" Some of them are very handy for debugging like to the value "value" Some of them are very handy for debugging like