diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c index 215d74cf5ff..e82c6579217 100644 --- a/dlls/urlmon/sec_mgr.c +++ b/dlls/urlmon/sec_mgr.c @@ -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; } diff --git a/dlls/urlmon/umon.c b/dlls/urlmon/umon.c index 249d85a8584..8493543750c 100644 --- a/dlls/urlmon/umon.c +++ b/dlls/urlmon/umon.c @@ -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; } diff --git a/dlls/urlmon/urlmon_main.c b/dlls/urlmon/urlmon_main.c index 342505b19c5..3a949c05a6f 100644 --- a/dlls/urlmon/urlmon_main.c +++ b/dlls/urlmon/urlmon_main.c @@ -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; }