QFatal where is the problem



  • I've got a software that suddenly gives me a qFatal from qlist::at but there is no stacktrace that tell me what caused it. Is there a god method to get the stacktrace or similar from the crash?


  • Moderators

    Run in debug mode if possible.

    A shot in the dark (but ion case of QList it's really very possible) is that somebody is trying to access an index outside of the list (index > QList::size()). Normally that crashes with a failed assertion.



  • I run in debug, and I know something is trying to access outside the list. But it is hard to detect from where this call is.


  • Moderators

    No stacktrace in debug mode? Have you compiled Qt yourself only in release mode, perhaps?



  • It is qt5.1 for mingw.
    When i recive qFatal the application keeps running in the background, but it is not possible to interact with it anymore.



  • The solution for me is to use: qInstallMessageHandler
    Install a new handler and break when the qFatal occurs.



  • Hi, just for your information, but a QList index is size() - 1 as maximum. It works like arrays in C, so with index 0, not 1!
    That might explain a crash.



  • The crash was QString::number sometimes convert a double incorrectly. It work maybe a million times and the suddenly dropped everything after the decimal, and coursed the a split operation to fail.



  • When we first are writing error handlers to capture errors. Is there an easy way to capture a stack trace? That would make it easier to debug a crash that is done by a customer.



  • Hi,
    In Qt5 you are able to install an event message handler. There your are able to store any data into a errorLog file etc before the crash really aborts the program (qFatal).
    Maybe that would add functionality to your program for debugging.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.