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. [Solved] Catch application crash and/or display message
QtWS25 Last Chance

[Solved] Catch application crash and/or display message

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 9.7k Views
  • 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.
  • R Offline
    R Offline
    Robbin
    wrote on last edited by
    #1

    This might be more C++ then Qt question, sorry about it. Also, I tried searching for few days now, looking for all kind of solutions, nothing seems to work as I want it to.

    I am developing an application which heavily uses the clipboard. All that the application does is to monitor the clipboard for certain text and once it finds it, takes out specific parts from the text, sorts and formats them in a certain way and puts them back into the clipboard. The application is working just OK, however the texts it is monitoring for can change every few months. I wont be updated in time when these texts changes, so I cannot update the app in time. Because of that and because of the way I made it search the text, it sometimes crashes.

    My question is - is it possible to catch for example the (system) ASSERTS in release builds and display them as messages (yes, tried qInstallMsgHandler(), it doesn't work in release build). A simple example would be if the app is trying to read from QList which is empty. In such case, my app would just "disappear" without any message. I would like to be able to catch such crashes and display message with information for the users, which information they will be able to send to me and help me resolve the problem faster.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fluca1978
      wrote on last edited by
      #2

      Well, the difference between a release and a debug mode is almost the debug information it can output autonomously. Since you are trying to understand errors in production environments I suggest you to implement a logging facility to control what your application is doing. And possibly to fix your design to handle special cases. Validating input, even when there is no input, is one of the most important tasks of an application.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        trollixx
        wrote on last edited by
        #3

        To handle application crashes we use "Google Breakpad":http://code.google.com/p/google-breakpad/. There're of course other projects like "CrashRpt":http://code.google.com/p/crashrpt/.

        Oleg

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Robbin
          wrote on last edited by
          #4

          Erm, maybe I should have said that I looked at breakpad, but didn't felt like using that. Maybe I don't fully understand how exactly it'll help me in the task, I don't know....

          fluca1978, I know that input validation is important, however the project was started generally as project to help me get involved with Qt, but I want to have something which will help me identify all the pitfalls which I have in the code and help me fix them faster, while helping me build a better help and report system for the app.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            trollixx
            wrote on last edited by
            #5

            Using Breakpad or similar tool will allow you to see where in the code the crash occurеd and variable values. So, better than this is only running program in debugger.

            Oleg

            1 Reply Last reply
            0
            • D Offline
              D Offline
              ddurhamdavyandbeth.com
              wrote on last edited by
              #6

              2nd on breakpad

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Robbin
                wrote on last edited by
                #7

                [quote author="trollixx" date="1322610273"]Using Breakpad or similar tool will allow you to see where in the code the crash occurеd and variable values. So, better than this is only running program in debugger.[/quote]

                That's exactly the problem man.... I want to be able to show error message to the user, before the app exits. I cannot know all the bugs beforehand, else I would have fixed them, right? So I want to be able to catch runtime problems and warn the users with something minimal but still useful that he will send me to debug the problem =/

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  trollixx
                  wrote on last edited by
                  #8

                  Breakpad allows you to catch application crash and do whatever you want afterwards, i.e. show message to use and send generated dump to you.

                  Oleg

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    Robbin
                    wrote on last edited by
                    #9

                    Well if there are no more suggestions, I guess that leaves me no choice, lol, will have to check breakpad again. Thanks for the input everyone.

                    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