Commit 132bc714 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Better module locking.

parent c64432ce
......@@ -82,8 +82,6 @@ static ULONG WINAPI SecManagerImpl_AddRef(IInternetSecurityManager* iface)
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
URLMON_LockModule();
return refCount;
}
......@@ -97,10 +95,9 @@ static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManager* iface)
/* destroy the object if there's no more reference on it */
if (!refCount){
HeapFree(GetProcessHeap(),0,This);
URLMON_UnlockModule();
}
URLMON_UnlockModule();
return refCount;
}
......@@ -201,6 +198,9 @@ HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
This->ref = 1;
*ppobj = This;
URLMON_LockModule();
return S_OK;
}
......@@ -247,8 +247,6 @@ static ULONG WINAPI ZoneMgrImpl_AddRef(IInternetZoneManager* iface)
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
URLMON_LockModule();
return refCount;
}
......@@ -262,10 +260,10 @@ static ULONG WINAPI ZoneMgrImpl_Release(IInternetZoneManager* iface)
TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
if(!refCount)
if(!refCount) {
HeapFree(GetProcessHeap(), 0, This);
URLMON_UnlockModule();
URLMON_UnlockModule();
}
return refCount;
}
......@@ -457,6 +455,8 @@ HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
ret->ref = 1;
*ppobj = (IInternetZoneManager*)ret;
URLMON_LockModule();
return S_OK;
}
......
......@@ -340,8 +340,6 @@ static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface)
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
URLMON_LockModule();
return refCount;
}
......@@ -359,9 +357,9 @@ static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface)
if (!refCount) {
HeapFree(GetProcessHeap(),0,This->URLName);
HeapFree(GetProcessHeap(),0,This);
}
URLMON_UnlockModule();
URLMON_UnlockModule();
}
return refCount;
}
......@@ -1170,6 +1168,8 @@ static HRESULT URLMonikerImpl_Construct(URLMonikerImpl* This, LPCOLESTR lpszLeft
else
strcpyW(This->URLName,lpszURLName);
URLMON_LockModule();
return S_OK;
}
......
......@@ -125,8 +125,6 @@ CF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
static ULONG WINAPI CF_AddRef(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
URLMON_LockModule();
return InterlockedIncrement(&This->ref);
}
......@@ -136,10 +134,10 @@ static ULONG WINAPI CF_Release(LPCLASSFACTORY iface)
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
HeapFree(GetProcessHeap(), 0, This);
URLMON_UnlockModule();
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
URLMON_UnlockModule();
}
return ref;
}
......@@ -229,10 +227,12 @@ DWORD WINAPI URLMON_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
factory->ITF_IClassFactory.lpVtbl = &CF_Vtbl;
factory->ref = 1;
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
*ppv = &(factory->ITF_IClassFactory);
URLMON_LockModule();
return S_OK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment