Results 1 to 3 of 3

Thread: SegFault when using QString

  1. #1
    Join Date
    Apr 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default SegFault when using QString

    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!

    toStdStringError.jpg
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: SegFault when using QString

    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,
    _

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: SegFault when using QString

    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.

Similar Threads

  1. Replies: 2
    Last Post: 11th August 2011, 16:42
  2. function returns QString, usage generates segfault
    By space_otter in forum General Programming
    Replies: 5
    Last Post: 8th March 2010, 16:54
  3. char* to QString. Segfault after delete []
    By TheRonin in forum Qt Programming
    Replies: 9
    Last Post: 19th June 2008, 14:20
  4. Replies: 4
    Last Post: 31st January 2008, 21:44
  5. Segfault
    By Dumbledore in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2007, 08:31

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.