[gstreamer-bugs] [Bug 592415] dshowsrcwrapper and wasapi uninitializes the COM library

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Thu Aug 20 13:36:39 PDT 2009


http://bugzilla.gnome.org/show_bug.cgi?id=592415



--- Comment #3 from Michael Smith <msmith at xiph.org> 2009-08-20 20:36:36 UTC ---
Julien:

Some issues with your suggestions:

1. gst_deinit is not normally called at all. It's mostly for cleanup in unit
tests etc, so you can check for leaks in globally-allocated data structures.

2. Calling CoInitializeEx(0, COINIT_MULTITHREADED) in the element's init
function doesn't help anything. Often this will be on the main thread (in which
case this isn't needed), and if/when it isn't, there's no reason to expect
anything else would be called from the same thread.

3. Not calling CoUninitialize() is probably likely to leak memory - if you have
a multithreaded apartment, and then you destroy the thread without having
called CoUninitialize(), then the COM stuff for that apartment is probably
leaked. I haven't checked this closely enough to be certain, though.

4. You're not quite right about when you need to call CoUninitialize(). The
actual rule, as far as I can tell, is:
   - If you call CoInitialize() successfully, you must call CoUninitialize()
from the same thread.
But a clearer way of thinking about it is:
   - For each successful call to CoInitialize() within a given apartment, there
must be a corresponding call to CoUninitialize() from within the same
apartment.
The 'apartments' here are: 1) The single threaded apartment, if any. 2) One
apartment for each multithreaded apartment (generally corresponding to one per
non-main thread)

-- 
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.




More information about the Gstreamer-bugs mailing list