diff options
| author | karlf <[email protected]> | 2016-08-11 13:28:13 -0700 |
|---|---|---|
| committer | karlf <[email protected]> | 2016-08-11 13:28:13 -0700 |
| commit | 96eb96dfb613e4c745db6bd1f53a92fe7e2290fc (patch) | |
| tree | ad5f3ede5cbcd6b598677ce41bcf8318471bdd92 /avstream/sampledevicemft/dllmain.cpp | |
| parent | 687b274aa38fd05c8c26e3068932121876d7f745 (diff) | |
Updated for "Windows 10 Anniversary Update" (Version 1607)
Diffstat (limited to 'avstream/sampledevicemft/dllmain.cpp')
| -rw-r--r-- | avstream/sampledevicemft/dllmain.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/avstream/sampledevicemft/dllmain.cpp b/avstream/sampledevicemft/dllmain.cpp index 7445bfbd..6978a9d5 100644 --- a/avstream/sampledevicemft/dllmain.cpp +++ b/avstream/sampledevicemft/dllmain.cpp @@ -24,9 +24,16 @@ #include <initguid.h> #ifdef MF_WPP -#include "dllmain.tmh" +#include "dllmain.tmh" //--REF_ANALYZER_DONT_REMOVE-- #endif +// +// The static variable needed to check the object count of the deviceMFts loaded. +// + +volatile long CDMFTModuleLifeTimeManager::s_lObjectCount = 0; + + HRESULT RegisterObject(HMODULE hModule, REFGUID guid, PCWSTR pszDescription, PCWSTR pszThreadingModel); @@ -203,7 +210,17 @@ STDMETHODIMP_(BOOL) WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, void *) STDMETHODIMP DllCanUnloadNow() { - return (g_cRefModule == 0) ? S_OK : S_FALSE; + HRESULT hr = ((g_cRefModule == 0) && (CDMFTModuleLifeTimeManager::GetDMFTObjCount() == 0)) ? S_OK : S_FALSE; + // + // Debug object lifetimes + // + DMFTRACE(DMFT_GENERAL, TRACE_LEVEL_INFORMATION, "%!FUNC! returning %d %d %!HRESULT!", + g_cRefModule, + CDMFTModuleLifeTimeManager::GetDMFTObjCount(), + hr); + + return hr; + } _Check_return_ |
