开发者

MFC WinApp calls InitInstance and OnAppExit/destructor in different threads

开发者 https://www.devze.com 2023-03-07 00:13 出处:网络
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 OnA

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消