mshtml: Removed the reference counting of the DLL.

This commit is contained in:
Alex Balut 2008-12-05 20:04:03 +01:00 committed by Alexandre Julliard
parent 22961e6560
commit fdac425f7f
4 changed files with 10 additions and 43 deletions

View File

@ -214,8 +214,6 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
NSContainer_Release(This->nscontainer); NSContainer_Release(This->nscontainer);
heap_free(This); heap_free(This);
UNLOCK_MODULE();
} }
return ref; return ref;
@ -1810,8 +1808,6 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
LOCK_MODULE();
doc->nscontainer = NSContainer_Create(doc, NULL); doc->nscontainer = NSContainer_Create(doc, NULL);
update_nsdocument(doc); update_nsdocument(doc);

View File

@ -44,7 +44,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml); WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
HINSTANCE hInst; HINSTANCE hInst;
LONG module_ref = 0;
DWORD mshtml_tls = 0; DWORD mshtml_tls = 0;
static HINSTANCE shdoclc = NULL; static HINSTANCE shdoclc = NULL;
@ -141,7 +140,6 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
if(!ref) { if(!ref) {
heap_free(This); heap_free(This);
UNLOCK_MODULE();
} }
return ref; return ref;
@ -158,11 +156,7 @@ static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
{ {
TRACE("(%p)->(%x)\n", iface, dolock); TRACE("(%p)->(%x)\n", iface, dolock);
if(dolock) /* We never unload the DLL. See DllCanUnloadNow(). */
LOCK_MODULE();
else
UNLOCK_MODULE();
return S_OK; return S_OK;
} }
@ -184,9 +178,7 @@ static HRESULT ClassFactory_Create(REFIID riid, void **ppv, CreateInstanceFunc f
ret->fnCreateInstance = fnCreateInstance; ret->fnCreateInstance = fnCreateInstance;
hres = IClassFactory_QueryInterface((IClassFactory*)ret, riid, ppv); hres = IClassFactory_QueryInterface((IClassFactory*)ret, riid, ppv);
if(SUCCEEDED(hres)) { if(FAILED(hres)) {
LOCK_MODULE();
}else {
heap_free(ret); heap_free(ret);
*ppv = NULL; *ppv = NULL;
} }
@ -230,8 +222,9 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
*/ */
HRESULT WINAPI DllCanUnloadNow(void) HRESULT WINAPI DllCanUnloadNow(void)
{ {
TRACE("() ref=%d\n", module_ref); TRACE("()\n");
return module_ref ? S_FALSE : S_OK; /* The cost of keeping this DLL in memory is small. */
return S_FALSE;
} }
/*********************************************************************** /***********************************************************************

View File

@ -668,10 +668,6 @@ DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,
DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b); DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
extern LONG module_ref;
#define LOCK_MODULE() InterlockedIncrement(&module_ref)
#define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
/* memory allocation functions */ /* memory allocation functions */
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len) static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)

View File

@ -77,17 +77,13 @@ static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo
static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface) static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
{ {
ProtocolFactory *This = PROTOCOLINFO_THIS(iface); TRACE("(%p)\n", iface);
TRACE("(%p)\n", This);
LOCK_MODULE();
return 2; return 2;
} }
static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface) static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
{ {
ProtocolFactory *This = PROTOCOLINFO_THIS(iface); TRACE("(%p)\n", iface);
TRACE("(%p)\n", This);
UNLOCK_MODULE();
return 1; return 1;
} }
@ -133,15 +129,7 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
{ {
ProtocolFactory *This = CLASSFACTORY_THIS(iface); TRACE("(%p)->(%x)\n", iface, dolock);
TRACE("(%p)->(%x)\n", This, dolock);
if(dolock)
LOCK_MODULE();
else
UNLOCK_MODULE();
return S_OK; return S_OK;
} }
@ -215,7 +203,6 @@ static ULONG WINAPI AboutProtocol_Release(IInternetProtocol *iface)
if(!ref) { if(!ref) {
heap_free(This->data); heap_free(This->data);
heap_free(This); heap_free(This);
UNLOCK_MODULE();
} }
return pUnkOuter ? IUnknown_Release(pUnkOuter) : ref; return pUnkOuter ? IUnknown_Release(pUnkOuter) : ref;
@ -408,9 +395,7 @@ static HRESULT WINAPI AboutProtocolFactory_CreateInstance(IClassFactory *iface,
hres = IInternetProtocol_QueryInterface(PROTOCOL(ret), riid, ppv); hres = IInternetProtocol_QueryInterface(PROTOCOL(ret), riid, ppv);
} }
if(SUCCEEDED(hres)) if(FAILED(hres))
LOCK_MODULE();
else
heap_free(ret); heap_free(ret);
return hres; return hres;
@ -583,7 +568,6 @@ static ULONG WINAPI ResProtocol_Release(IInternetProtocol *iface)
if(!ref) { if(!ref) {
heap_free(This->data); heap_free(This->data);
heap_free(This); heap_free(This);
UNLOCK_MODULE();
} }
return pUnkOuter ? IUnknown_Release(pUnkOuter) : ref; return pUnkOuter ? IUnknown_Release(pUnkOuter) : ref;
@ -833,9 +817,7 @@ static HRESULT WINAPI ResProtocolFactory_CreateInstance(IClassFactory *iface, IU
hres = IInternetProtocol_QueryInterface(PROTOCOL(ret), riid, ppv); hres = IInternetProtocol_QueryInterface(PROTOCOL(ret), riid, ppv);
} }
if(SUCCEEDED(hres)) if(FAILED(hres))
LOCK_MODULE();
else
heap_free(ret); heap_free(ret);
return hres; return hres;