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. Detect when application crashes
Forum Updated to NodeBB v4.3 + New Features

Detect when application crashes

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 566 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.
  • H Offline
    H Offline
    hbatalha
    wrote on last edited by
    #1

    I want to know if there is a way to detect or handle application crashes.

    For example what if the application is to change some system settings only when it is open and has to change it back to how it was when closing, how to ensure that if the application finishes unexpectedly?

    W 1 Reply Last reply
    0
    • H hbatalha

      I want to know if there is a way to detect or handle application crashes.

      For example what if the application is to change some system settings only when it is open and has to change it back to how it was when closing, how to ensure that if the application finishes unexpectedly?

      W Offline
      W Offline
      wrosecrans
      wrote on last edited by
      #2

      Have a separate process that executes the "real" process. If it returns anything other than EXIT_SUCCESS, it crashed, and you can try to handle it as best you can.

      H 1 Reply Last reply
      0
      • W wrosecrans

        Have a separate process that executes the "real" process. If it returns anything other than EXIT_SUCCESS, it crashed, and you can try to handle it as best you can.

        H Offline
        H Offline
        hbatalha
        wrote on last edited by
        #3

        @wrosecrans said in Detect when application crashes:

        Have a separate process that executes the "real" process

        Can you elaborate more on that?

        1 Reply Last reply
        0
        • gde23G Offline
          gde23G Offline
          gde23
          wrote on last edited by
          #4

          As wrosecrans suggested you can have two executables, and the second one is watching if the first one is still running.
          So the user starts the watcher, there the main process is started (you can use QProcess for that) and when it crashes the watcher can do something.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sdfdfg
            Banned
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • H Offline
              H Offline
              hbatalha
              wrote on last edited by
              #6

              Thanks, I will try that

              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