Fix line numbers in stack traces under macOS

The last digit was truncated as the code discarded the trailing "\n"
which wasn't really there, as ReadLine() helper function already removed
it, and so ended up removing the last digit of the line number,
resulting in mostly plausibly looking but completely wrong line
information in the assert dialog.
This commit is contained in:
Vadim Zeitlin 2019-06-27 16:12:26 +02:00
parent 584e2715eb
commit 789d374650

View File

@ -286,18 +286,18 @@ int wxStackWalker::InitFrames(wxStackFrame *arr, size_t n, void **addresses, cha
// func(args) (in module) (file:line)
//
// or just the same address back if it couldn't be resolved.
const size_t posIn = buffer.find("(in ");
const size_t posIn = buffer.find(" (in ");
if ( posIn != wxString::npos )
{
name.assign(buffer, 0, posIn);
size_t posAt = buffer.find(") (", posIn + 3);
size_t posAt = buffer.find(") (", posIn + 5); // Skip " (in "
if ( posAt != wxString::npos )
{
posAt += 3; // Skip ") ("
// Discard the two last characters which are ")\n"
wxString location(buffer, posAt, buffer.length() - posAt - 2);
// Discard the last character which is ")"
wxString location(buffer, posAt, buffer.length() - posAt - 1);
wxString linenum;
filename = location.BeforeFirst(':', &linenum);