PDA

View Full Version : SegFault when using QString



french13
13th April 2016, 18:09
Hello,

I'm receiving a SEGFAULT error in a few places in the QString library. This particular instance in using the .toStdString() call, but I also receive a segfault when using .split(QRegExp()). I've attached a screenshot of the debug output. I have this code working in a GUI application, and I'm in the process of creating a console program to perform the same function. The GUI app works perfectly, but for some reason the console throws a segfault error every time, at roughly the same time in the program. If I run in release mode, the executions roughly triple before the error occurs. Is there something I am doing wrong in the console application that would cause this problem?

Because this error occurs in the QString code and not my own, I'm not sure if this is the proper venue for this question. If it should be moved to a bug report please let me know.

Thanks!

11888

anda_skoa
13th April 2016, 18:30
So why don't you post something useful instead, like where this call originates from instead of the end of the stack trace which does only contain library code?

Cheers,
_

d_stranz
14th April 2016, 18:22
My guess is that your program has corrupted the stack or heap somehow, and that the error throws the execution into some random place in the executable, in this case the library that contains the QString code. It is undoubtedly a red herring, and the error that causes this is somewhere else *in your code*, not in QString.

As anda_skoa says, post something useful, like a stack trace (not an unreadable screenshot of a stack trace, the text itself). Better yet, examine the stack trace yourself to see where your code calls into the Qt library. The error is likely to be somewhere in that code. If it isn't obvious, run the debugger, set a breakpoint in your code shown in the stack trace, and examine all of the variables being used at that point (including "this" if you are in a class method) to see if they make sense.

Happy hunting.