diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index ef32e59f1d..0f2c5edd34 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -772,7 +772,17 @@ void ShowAssertDialog(const wxChar *szFile, StackDump dump; dump.Walk(5); // don't show OnAssert() call itself - const wxString& stackTrace = dump.GetStackTrace(); + wxString stackTrace = dump.GetStackTrace(); + + const int maxLines = 10; + // Don't show more than maxLines or we could get an enormous dialog + int count = stackTrace.Freq(wxT('\n')); + if (count > maxLines) + { + int i; + for (i = 0; i < count - maxLines; i++) + stackTrace = stackTrace.BeforeLast(wxT('\n')); + } if ( !stackTrace.empty() ) { msg << _T("\n\nCall stack:\n") diff --git a/src/unix/stackwalk.cpp b/src/unix/stackwalk.cpp index 9ad52db9e6..b8b92ef924 100644 --- a/src/unix/stackwalk.cpp +++ b/src/unix/stackwalk.cpp @@ -221,9 +221,12 @@ void wxStackWalker::Walk(size_t skip) char **symbols = backtrace_symbols(addresses, depth); - for ( int n = 0; n < depth; n++ ) + if (skip > (size_t) depth) + skip = (size_t) depth; + + for ( int n = skip; n < depth; n++ ) { - wxStackFrame frame(n, addresses[n], symbols[n]); + wxStackFrame frame(n, addresses[n-skip], symbols[n-skip]); OnStackFrame(frame); } }