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