Nikolay Sivov : hnetcfg: Release typeinfos and typelib on dll unload.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jan 20 15:20:10 CST 2015
Module: wine
Branch: master
Commit: 4782be7e31c1a605d5dc5ea619a06ddcec75e26a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4782be7e31c1a605d5dc5ea619a06ddcec75e26a
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Jan 14 13:39:22 2015 +0300
hnetcfg: Release typeinfos and typelib on dll unload.
---
dlls/hnetcfg/apps.c | 12 ++++++++++++
dlls/hnetcfg/hnetcfg.c | 8 ++++++--
dlls/hnetcfg/hnetcfg_private.h | 1 +
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c
index a0530e1..d21ed98 100644
--- a/dlls/hnetcfg/apps.c
+++ b/dlls/hnetcfg/apps.c
@@ -148,6 +148,18 @@ HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
return S_OK;
}
+void release_typelib(void)
+{
+ unsigned i;
+
+ for (i = 0; i < sizeof(typeinfo)/sizeof(*typeinfo); i++)
+ if (typeinfo[i])
+ ITypeInfo_Release(typeinfo[i]);
+
+ if (typelib)
+ ITypeLib_Release(typelib);
+}
+
static HRESULT WINAPI fw_app_GetTypeInfo(
INetFwAuthorizedApplication *iface,
UINT iTInfo,
diff --git a/dlls/hnetcfg/hnetcfg.c b/dlls/hnetcfg/hnetcfg.c
index 809b540..fadd367 100644
--- a/dlls/hnetcfg/hnetcfg.c
+++ b/dlls/hnetcfg/hnetcfg.c
@@ -114,9 +114,9 @@ static hnetcfg_cf fw_manager_cf = { { &hnetcfg_cf_vtbl }, NetFwMgr_create };
static hnetcfg_cf fw_app_cf = { { &hnetcfg_cf_vtbl }, NetFwAuthorizedApplication_create };
static hnetcfg_cf fw_openport_cf = { { &hnetcfg_cf_vtbl }, NetFwOpenPort_create };
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved)
{
- TRACE("(0x%p, %d, %p)\n",hInstDLL,fdwReason,lpvReserved);
+ TRACE("(0x%p, %d, %p)\n", hInstDLL, fdwReason, reserved);
switch(fdwReason) {
case DLL_WINE_PREATTACH:
@@ -125,6 +125,10 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
instance = hInstDLL;
DisableThreadLibraryCalls(hInstDLL);
break;
+ case DLL_PROCESS_DETACH:
+ if (reserved) break;
+ release_typelib();
+ break;
}
return TRUE;
}
diff --git a/dlls/hnetcfg/hnetcfg_private.h b/dlls/hnetcfg/hnetcfg_private.h
index 1045347..6fe69d5 100644
--- a/dlls/hnetcfg/hnetcfg_private.h
+++ b/dlls/hnetcfg/hnetcfg_private.h
@@ -28,6 +28,7 @@ enum type_id
};
HRESULT get_typeinfo(enum type_id, ITypeInfo **) DECLSPEC_HIDDEN;
+void release_typelib(void) DECLSPEC_HIDDEN;
HRESULT NetFwMgr_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
HRESULT NetFwPolicy_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list