Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23

Thread: How to crash gracefully

  1. #21
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to crash gracefully

    Quote Originally Posted by wysota View Post
    Besides, if you fear things such as assert(), then simply do a gracefull error check and recovery instead of asserting.
    In a perfect world, we all should be doing that. Unfortunately, no one can write a bug free software. Nobody wants to be hit by a car, it is just the car hits people

    Anyway, I have a crash test, if anyone fix or solve a problem, please include in this thread so we all get benefit of it.
    Attached Files Attached Files

  2. #22
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to crash gracefully

    Quote Originally Posted by lni View Post
    In a perfect world, we all should be doing that. Unfortunately, no one can write a bug free software. Nobody wants to be hit by a car, it is just the car hits people
    Does it matter if instead of assert() you call myAssert()? Especially that AFAIR it's a macro anyway...

    Qt Code:
    1. void myAssert(bool t){
    2. if(t) return;
    3. QMessageBox::critical(0, "Assert", "An assert has occured, the application will close");
    4. abort();
    5. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #23
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    136
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to crash gracefully

    If you want to be able to issue a full report from your application, there is a simple way to do it. Start your application as a child process of another application that will act as a feedback manager. The parent can monitor the state of the child and when it terminates, it can read its stderr (that can contain a backtrace) and can send the data to the producer or do a number of different things.
    I tried this suggested method with QProcess and was able to catch the crash. However the Windows crash dialog also came up, which would be confusing for the user.
    Do you know how to make Windows leave me alone? Do I need to suppress signals like SIGABRT?
    Alternatively maybe I could try and access the Windows crash data...

    Sorry that this question is moving out of Qt territory and into C++/Windows programming. If you think it's too off topic I could reask it in a more relevant forum.
    I'm usually a Linux programmer so this kind of stuff is particularly frustrating!

Similar Threads

  1. Crash: Heap corruption due to selectedRows()
    By Ankitha Varsha in forum Qt Programming
    Replies: 16
    Last Post: 1st October 2010, 00:55
  2. Replies: 28
    Last Post: 9th March 2010, 08:59
  3. Qwt crash in Vista
    By roland8454 in forum Qwt
    Replies: 3
    Last Post: 3rd February 2009, 19:53
  4. Replies: 2
    Last Post: 13th August 2008, 17:46
  5. QTimer ->start(0) + OpenGL + resize/move window => crash
    By anthibug in forum Qt Programming
    Replies: 5
    Last Post: 8th July 2008, 11:01

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.