PDA

View Full Version : Error when close Qt program : "The program has unexpectedly finished "



alizadeh91
17th September 2012, 06:19
Hi all..
I'm writing a big project with Qt and it works well until now, but there's something that concerns me.
When i close the program there is an error in debug window(Application output window):

"The program has unexpectedly finished."

I thought it must be threads but I've checked all the threads in the program and they are safe.

What are possibilities of this error?? Thanks :)

ChrisW67
17th September 2012, 06:53
The usual cause is using a pointer that is invalid. Your debugger will likely tell show you exactly which line crashed if you inspect the stack back trace.

alizadeh91
17th September 2012, 12:26
What do you mean by that is invalid???

wysota
17th September 2012, 12:54
What do you mean by that is invalid???

That it is not pointing to an area of memory holding a valid object that is expected to be there.

Zlatomir
17th September 2012, 15:23
Another way to get to that kind of error (related to pointer being invalid) is by allocating child widgets on the stack and if the parent is deleted (or goes out of scope) first it calls delete with the child address (that is actually not allocated on heap so delete will cause the error).