If one day, you found that your program has many functions that should be executed at the end of the Debug version, but it is performed in the Release version. Take a look at the following article may make you helpless and dark I saw a little hope.
I have encountered it today. Our project has been developed for a long time, the amount of code is very big. We have always been cautious, but suddenly, when I debug the procedure:
I have the window of the program (want to exit the program). The result of the VC6 flashed a lot of memory leaks. After checking, it is actually because the program's cwinapp :: exitInstance function is not executed. I feel strange, I have always been well. Why do you suddenly this? Explore in the dark, the clue only one: The program is actually under the Release version, CWINAPP :: EXITInstance has also been executed.
Since the amount of code is really big, after a long search process, it will not be fine.
....................
Finally, the reason is to use an assert (), statement in the CMAINFRAME :: ~ CMAINFRAME () function. And the condition is false. Although this assertion is triggered.
But in fact, the dialog is not bounced. Silent and interesting will give the process to Exit.
Slightly studied the reason later:
The Assert function will finally call an internal API (actually MessageBoxa) to pop up the assertion dialog, but if the window of all the windows of your program has dropped, this dialog can't play it ( I haven't found the reason for the time being. It seems that Microsoft is designed. Everyone knows that there are three buttons on the disclaimed dialog: abort, retry and ignore. The default is to stop, at this time because the dialog is not displayed Therefore, the system is not recognized to stop the process. This suspension is forced, the system does not work for objects. The structure leads to many of the cleaning resources of the program after the program is not executed.
in conclusion:
Everyone is best not to use assertions after the main window of the program, so as not to bring inexplicable mistakes to the program. Because this error is really hard to find ^ _ ^
In addition, I was still surprised to discover, as long as IASERT, PEEKMESSAGE (& MSG, 0, 0, 0, 1); this sentence, the assertion dialog can be played out. The reason I have not found it yet, interested Friends don't prevent research!
MSN: SXXNY@hotmail.com
2004-08-24