Archived

This topic is now archived and is closed to further replies.

BauerGL

CoUninitialize() hangs

Recommended Posts

BauerGL    467
I have a strange problem with CoUninitialize(). It only happens if I use CoInitialize/Ex() and then initializes the server or adapter object. By just calling CoInitialize() and then CoUninitialize() everything works fine. For some reason it hangs my server, though my client works fine. I''m doing the exact same thing on the client and the server, the only difference is the use of client/server objects. One other note is that the server is a console app while the client is a win32 app. I am absolutely clueless about this so I''m wondering if any of you have encountered this problem before or if you have any tips to give away. Thanks for reading.

Share this post


Link to post
Share on other sites
BauerGL    467
Yea that''s the one I''m using (sorry, I see that it wasn''t clear in my previous post.)

I believe that the problem occurs on the client as well now.. it fails to shutdown (i.e it hides in the task manager) on CoUninitialize().

Share this post


Link to post
Share on other sites
hplus0603    11348
First: the kernel will uninitialize for you. Just don''t worry about it. ExitProcess() is the quickest way to quit your game, so use it without wasting time on closing and deleting objects. The kernel will clean up -- that''s it''s main job!

Second: if you want to CoUninitialize() for some reason (random aesthetics? provable leak-free-ness?) then you must make sure that all references to all interfaces that your process holds are first released. This includes references that some library you''re using may hold.

The reason you''re hanging is probably this (from MSDN documentation):
quote:

If there are open conversations remaining, CoUninitialize starts a modal message loop and dispatches any pending messages from the containers or server for this COM application. By dispatching the messages, CoUninitialize ensures that the application does not quit before receiving all of its pending messages.


Share this post


Link to post
Share on other sites