[Solved] Release mode crashing but not Debug mode?
I have a strange problem for my application.
When I run the application from Qt Creator in Debug mode it is running fine.
But when I run in Release mode it is crashing.
Using qDebug() & a log file I know that it is completing the constructor of my Main Window class. After that when it goes into Qt's internal mechanism it is crashing. For about a second I am able to see Window with title bar & everything is white inside. Then it crashes.
How do I know what is the cause of problem?
And why is this only happening in Release mode?
Debug mode (not only in Qt, but in C++ in general) is less restrictive during runtime (it will allow you to go over reserved memory, it won't crash on some occasions etc.). So it indeed does sometimes happen that an app is running fine in debug, but bails out in release. What it means, however, is that you do have a bug in your code (dangling pointer, or perhaps an overflow in an array (using an index in QList that is greater than size(), for example)).
I'm having this issue. Totally ruins the point of "debugging" :-/
[quote author="Nayar" date="1389636196"]I'm having this issue. Totally ruins the point of "debugging" :-/[/quote]
Only in some cases. And the fact that it happens should already point you in a right direction: you can be close to certain that you are doing something wrong with memory. Now just get a stack trace and try to guess where it failed :)
Managed to catch it :)
But where to get the stack trace? I know it pops up when run in debugging mode. But mine was crashing in normal running only.
On Linux, you can use strace. On Mac, you will get a stack trace every time: when the application crashes, Mac will try to send a report to Apple. You can take a look into it, it includes complete stack trace and a wealth of additional information. On Windows - sorry, I have no idea. But there has to be some tool available.
Yeah sometimes I feel like banging my laptop.
But as usual Microsoft has let us developers down...
[quote author="CAD_coding" date="1389667198"]Yeah sometimes I feel like banging my laptop.
But as usual Microsoft has let us developers down...[/quote]
It's not Microsoft's fault when you don't know the system very well from developers point of view...
See "this":http://msdn.microsoft.com/en-us/library/windows/hardware/ff542967(v=vs.85).aspx for example.
Also you can use QtCreator as post-mortem debugger on windows. Call this:
Make sure that your release binaries are built with debug-symbols. Using msvc compilers this would be *.pdb files.