03 Mar 2013
This is a common error while working with Qt (and C++ in general). You will write some code, compile it without errors or warnings and when you run the application it will crash and throw a “The program has unexpectedly finished.” in the Application Output.
The most common cause of this is using an object you have declared a pointer for but have not allocated.
This piece of code will make the application crash:
But this one won’t:
The first example is obviously wrong, but it’s easy to forget the memory allocation when the code starts getting longer.