Results 1 to 4 of 4

Thread: How to catch "access violation" exception in QT?

  1. #1
    Join Date
    Mar 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default How to catch "access violation" exception in QT?

    Hi All,

    We have built an application in QT which internally uses third party libraries like boost. We want to catch the exceptions throw which are thrown by these libraries e.g "acess violation" [0xC0000005: Access violation reading location 0x00000004.] exception.

    But these exceptions are not catched in "catch(std::exception& e)" or "catch(...)" .

    Please let me know how to catch such exceptions in QT.

    Thanks in advance,
    Vrushali

  2. #2
    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 catch "access violation" exception in QT?

    Qt doesn't deal with things like that. Use mechanisms provided by the programming language you are using.
    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. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to catch "access violation" exception in QT?

    Quote Originally Posted by vrushalid View Post
    Please let me know how to catch such exceptions in QT.
    Qt has nothing to do with exception handling: that's between you and your programming language.

    The exception you have is the result of using a null/invalid pointer or possibly an undefined reference. Such exceptions are not recoverable: they are fundamental flaws in your program logic not exceptions to normal program flow. You "catch" these exceptions using your debugger to identify the offending pointer from the stack backtrace, locate the logic error in your program, and repair your code.

  4. #4
    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 catch "access violation" exception in QT?

    Technically you can catch those as well (e.g. by intercepting SIGSEGV) however rarely there is a point in doing so (apart dumping a backtrace to the log and cleaning up before aborting to prevent a nuclear meltdown if your app happens to operate a nuclear power plant).
    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.


Similar Threads

  1. how to catch "click" signal on the dialog
    By fulbay in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2011, 11:27
  2. [WebKit] catch "page not found" error
    By maston in forum Qt Programming
    Replies: 3
    Last Post: 16th November 2010, 15:44
  3. Replies: 2
    Last Post: 20th March 2010, 18:22
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. How do debug "Unhandled Win32 Exception"
    By Doug Broadwell in forum Qt Programming
    Replies: 1
    Last Post: 4th October 2006, 05:17

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.