mfc app not shutting down (hanging) after extended usage of word/excel/msxml automation

N

Nicolas Stohler

we have an MFC mdi application which creates reports using word/excel
automation in combination with msxml. this all happens in a modal
dialog, all interfaces are "#import"ed, using com smart pointers.

When we create small reports and exit the program, everything gets
closed correctly, the application shuts down nicely. But when we create
a set of more complex reports, which take some time to complete,
there's the problem that the application cannot be shut down correctly
afterwards - the windows close, ExitInstance gets called (and
completes), but the call to ::OleUninitialize() inside AfxOleTerm()
just does never complete!

When I tried to debug it and breakpointed at ::OleUninitialize(), I
noticed the following: for single, short reports (working case), when I
execute the critical line :):OleUninitialize()), the output window
displays the "library unloaded "msxml6.dll" message. For the bad case
(lengthy, large reports), this message doesnt get displayed, it just
hangs forever.

I tried unloading msxml6.dll inside ExitInstance ( FreeLibrary(
handleToMsxml6 ); ), but this only resulted in a crash later on.

Also, we use com smart pointers for the whole automation process for
word/excel/msxml, so there should be no leaked/unreleased objects? or
if this is still possible, is there any way to detect those unreleased
objects? Can I check the reference counts of those smart pointer
objects? if so, how?

Any ideas what the problem exactly is and how to resolve it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top