0

Yeah. This was what I was wondering. Because I am initializing arrays using the new function, I was wondering if there was any way that I could catch a force close (clicking the X or using end task) so I could delete [] the array.

Or maybe the array is automatically cleared from memory when the application closes :S I'm not too sure.

5
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by fskreuz
0

> ...maybe the array is automatically cleared from memory when the application closes...

right, provided your program is running under an os ( like unix, windows, linux ... ) which gives a separate virtual address space for each process. when a process terminates, all the resources it owns are reclaimed by the system; and its private memory would be deallocated.

0

be sure to disable or change the default close behavior... In java at least close is defaulted to do nothing so you have to set it yourself... I've never built a GUI in C++ before so I wouldn't know where to begin, but likely the pitfalls will be similar! Overload or override!

0

I see that the function runs when the window is about to close on itself. but is there a way or function to execute a command when the user actually clicks on the close button? or when the program is forcefully closed (let' s say when the PC is going to be turned off)? i have googled around but can't get any leads to this function, if there is any.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.