Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Get the Error type which cause the application crash

    General and Desktop
    3
    7
    1164
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Shahina last edited by VRonin

      I am using Qt 4.8. I used qInstallMsgHandler() and i handle critical and fatal error like

       void myMessageOutput(QtMsgType type, const char *msg)
      {
          switch (type) {
          case QtCriticalMsg:
             //restarts application
              break;
          case QtFatalMsg:
              // restarts application
              break;
          }
      }
      

      It works properly when i get fatal or critical. But some time my application get crash without giving the critical or fatal msg. Is ther any way to get what type of error my application getting crash.

      K 1 Reply Last reply Reply Quote 0
      • K
        koahnig @Shahina last edited by

        @Shahina

        You are only catching the errors listed in here. Basically you have to call those functions listed on the right and your application will end up in your message handler with an appropriate error code. Therefore, you need to know where in your application critical conditions are being encountered. Unfortunately, it does not support a crystal ball functionality covering all possible errors.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply Reply Quote 2
        • S
          Shahina last edited by

          Ok its clear now. But i cannot encounters the critical condition in my application beacuse i am using a third party dll. Some times it get crash from dll only. I dont have source. Is there any way to handle crash in my application itself.

          K 1 Reply Last reply Reply Quote 0
          • K
            koahnig @Shahina last edited by

            @Shahina

            You would need to check the documentation of the dll. Possibly there are some measures implemented for catching possible error conditions.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply Reply Quote 0
            • V
              VRonin last edited by

              if your library is throwing an exception it's just up to you to catch it: http://www.cplusplus.com/doc/tutorial/exceptions/

              if it's just crashing because of a segmentation fault or similar there are libraries to convert them into exceptions: https://github.com/Plaristote/segvcatch

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply Reply Quote 2
              • S
                Shahina last edited by

                Thanks for the links. It helped me. Is there any way to have gloabl try and catch block in qt ?

                1 Reply Last reply Reply Quote 0
                • V
                  VRonin last edited by

                  well, if you start the try block in the main function then it should catch any unhanded exception

                  "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                  ~Napoleon Bonaparte

                  On a crusade to banish setIndexWidget() from the holy land of Qt

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post