PDA

View Full Version : application crash problem



anshul
24th December 2009, 12:46
I have a typical problem with QT creator (1.2.1 based on QT4.5.2)

1) when i run my application using ctrl+r (free run), I crashes (unhandled expection)
2) when i run with using F5 (attaching a debugger) , it runs fine.

This is same for both debug and release build.

So as i can conclude
1) it is not a debug or release build issue, as usig F5 button , application runs fine in both build
2) it is a problem related to attaching the debugger to application , because using F5 button you are attaching the debugger to your application. while with Ctrl+r (free run ) you don't . and application only crashes in latter case.

Can somebody help to analyze how to solve it.

rubenvb
24th December 2009, 14:51
I know exactly how to solve your problem:

1) for some reason the run in debug mode knows where to look for the dll's, and the free run as you describe it doesn't.
2) to solve the crash: copy the QtCore4.dll, QtGui4.dll and other libs you link against to the same directory as the .exe file. No more problem :)

anshul
25th December 2009, 03:15
No this is not the problem, as the application start running and crashes after some time.

Infact i figured out the solution.

The basic difference between free run (Ctrl+R) and debug run (F5, i.e. debugger attached ) is teh use of heap.
When the debugger is attached , system uses DEBUG HEAP.

In order to have same behaviour you can stop using the debugger use the debug heap , set the environment variable _NO_DEBUG_HEAP = 1.

The your will be able to produce the same crash with pressing F5 key, i.e. running with debugger attached.

rubenvb
25th December 2009, 12:27
Oh ok, I assumed it was a crash on startup... guess it's a logical/programming error in your code if it crashes at some point after loading libs... Can't help there if there's no code to debug :)

PS: I also noticed that windows throws no out-of-bounds exceptions when in debug mode... which is pretty sh*tty when you think everything works until you build a release version and you get a cryptic runtime exception :)