Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

looks like a race when managed code calls COM destructors as dll is unloaded

12 views
Skip to first unread message

lbj...@yahoo.com

unread,
May 30, 2015, 5:58:18 PM5/30/15
to


I have some .NET C# code that instantiates and utilizes C++ COM objects. The dll that hosts the COM objects has some global objects. When the .Net application is terminating, I see (via debugger) that as one of my COM objects is executing it's FinalRelease code, all of a sudden it's thread of execution is interrupted and I land in the destructor of my CWinapp. So my first question is:

1) Can anyone tell me what is going on there?

Also, in a related question, when the destructor of my CWinapp is executed it in turn calls the destructors of the globals objects I mentioned earlier (via the delete operator). When this happens it causes a very strange crash (runtime error R6205 Pure virtual function call), which looks to me like some kind of memory corruption. So econd question:

2) Is the CWinapp destructor the right place to clean up globals? If not, what is a good spot?

Thanks!!!
0 new messages