projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
made wxList methods return compatibility_iterator instead of Node * to further reduce...
[wxWidgets.git]
/
src
/
common
/
appbase.cpp
diff --git
a/src/common/appbase.cpp
b/src/common/appbase.cpp
index fd408ab0d95aee5ac8c709687e25a03a0d68aa69..5a6a35127ef3c810fed2c9e48d24e519116a38be 100644
(file)
--- a/
src/common/appbase.cpp
+++ b/
src/common/appbase.cpp
@@
-93,6
+93,7
@@
static
void ShowAssertDialog(const wxChar *szFile,
int nLine,
static
void ShowAssertDialog(const wxChar *szFile,
int nLine,
+ const wxChar *szFunc,
const wxChar *szCond,
const wxChar *szMsg,
wxAppTraits *traits = NULL);
const wxChar *szCond,
const wxChar *szMsg,
wxAppTraits *traits = NULL);
@@
-434,12
+435,21
@@
bool wxAppConsole::CheckBuildOptions(const char *optionsSignature,
#ifdef __WXDEBUG__
#ifdef __WXDEBUG__
+void wxAppConsole::OnAssertFailure(const wxChar *file,
+ int line,
+ const wxChar *func,
+ const wxChar *cond,
+ const wxChar *msg)
+{
+ ShowAssertDialog(file, line, func, cond, msg, GetTraits());
+}
+
void wxAppConsole::OnAssert(const wxChar *file,
int line,
const wxChar *cond,
const wxChar *msg)
{
void wxAppConsole::OnAssert(const wxChar *file,
int line,
const wxChar *cond,
const wxChar *msg)
{
-
ShowAssertDialog(file, line, cond, msg, GetTraits()
);
+
OnAssertFailure(file, line, NULL, cond, msg
);
}
#endif // __WXDEBUG__
}
#endif // __WXDEBUG__
@@
-587,19
+597,10
@@
void wxTrap()
#endif // Win/Unix
}
#endif // Win/Unix
}
-void wxAssert(int cond,
- const wxChar *szFile,
- int nLine,
- const wxChar *szCond,
- const wxChar *szMsg)
-{
- if ( !cond )
- wxOnAssert(szFile, nLine, szCond, szMsg);
-}
-
// this function is called when an assert fails
void wxOnAssert(const wxChar *szFile,
int nLine,
// this function is called when an assert fails
void wxOnAssert(const wxChar *szFile,
int nLine,
+ const char *szFunc,
const wxChar *szCond,
const wxChar *szMsg)
{
const wxChar *szCond,
const wxChar *szMsg)
{
@@
-618,16
+619,19
@@
void wxOnAssert(const wxChar *szFile,
s_bInAssert = true;
s_bInAssert = true;
+ // __FUNCTION__ is always in ASCII, convert it to wide char if needed
+ const wxString strFunc = wxString::FromAscii(szFunc);
+
if ( !wxTheApp )
{
// by default, show the assert dialog box -- we can't customize this
// behaviour
if ( !wxTheApp )
{
// by default, show the assert dialog box -- we can't customize this
// behaviour
- ShowAssertDialog(szFile, nLine, szCond, szMsg);
+ ShowAssertDialog(szFile, nLine, s
trFunc, s
zCond, szMsg);
}
else
{
// let the app process it as it wants
}
else
{
// let the app process it as it wants
- wxTheApp->OnAssert
(szFile, nLine
, szCond, szMsg);
+ wxTheApp->OnAssert
Failure(szFile, nLine, strFunc
, szCond, szMsg);
}
s_bInAssert = false;
}
s_bInAssert = false;
@@
-738,7
+742,7
@@
static wxString GetAssertStackTrace()
};
StackDump dump;
};
StackDump dump;
- dump.Walk(
5
); // don't show OnAssert() call itself
+ dump.Walk(
2
); // don't show OnAssert() call itself
stackTrace = dump.GetStackTrace();
// don't show more than maxLines or we could get a dialog too tall to be
stackTrace = dump.GetStackTrace();
// don't show more than maxLines or we could get a dialog too tall to be
@@
-757,6
+761,7
@@
static wxString GetAssertStackTrace()
static
void ShowAssertDialog(const wxChar *szFile,
int nLine,
static
void ShowAssertDialog(const wxChar *szFile,
int nLine,
+ const wxChar *szFunc,
const wxChar *szCond,
const wxChar *szMsg,
wxAppTraits *traits)
const wxChar *szCond,
const wxChar *szMsg,
wxAppTraits *traits)
@@
-772,6
+777,11
@@
void ShowAssertDialog(const wxChar *szFile,
// the failed assert
msg.Printf(wxT("%s(%d): assert \"%s\" failed"), szFile, nLine, szCond);
// the failed assert
msg.Printf(wxT("%s(%d): assert \"%s\" failed"), szFile, nLine, szCond);
+ // add the function name, if any
+ if ( szFunc && *szFunc )
+ msg << _T(" in ") << szFunc << _T("()");
+
+ // and the message itself
if ( szMsg )
{
msg << _T(": ") << szMsg;
if ( szMsg )
{
msg << _T(": ") << szMsg;