Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get the Error type which cause the application crash
Forum Updated to NodeBB v4.3 + New Features

Get the Error type which cause the application crash

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.5k Views 1 Watching
  • 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 Offline
    S Offline
    Shahina
    wrote on last edited by VRonin
    #1

    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
    0
    • S Shahina

      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 Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @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
      2
      • S Offline
        S Offline
        Shahina
        wrote on last edited by
        #3

        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
        0
        • S Shahina

          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 Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @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
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            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
            2
            • S Offline
              S Offline
              Shahina
              wrote on last edited by
              #6

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

              1 Reply Last reply
              0
              • VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #7

                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
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved