MFC WinApp calls InitInstance and OnAppExit/destructor in different threads
I got problem at one of our customers environment - when I AfxGetApp()->WriteProfileString in OnAppExit (or destructor) it doesn't work. I cannot reproduce it anywhere. I tracked it down that the OnAppExit is called from different thread than InitInstance - again, this isn't true at any of my machines.
Can it be the issue? And, why does the OnAppExit gets ca开发者_StackOverflow社区lled in different thread? Thanks.
OnAppExit
might get called on a different thread if you have threads in your app which generate an error and call exit
. Under normal usage OnAppExit
should only be called in your main thread. Here's the documentation for exit
- http://msdn.microsoft.com/en-us/library/k9dcesdd.aspx.
精彩评论