From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/ole32/compobj_private.h | 1 - dlls/ole32/git.c | 55 +++++++++++++++--------------------- 2 files changed, 23 insertions(+), 33 deletions(-)
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h index 1b7aa5640ce..b64dfbf4f4a 100644 --- a/dlls/ole32/compobj_private.h +++ b/dlls/ole32/compobj_private.h @@ -187,7 +187,6 @@ struct oletls
/* Global Interface Table Functions */ -extern IGlobalInterfaceTable *get_std_git(void) DECLSPEC_HIDDEN; extern void release_std_git(void) DECLSPEC_HIDDEN; extern HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv) DECLSPEC_HIDDEN;
diff --git a/dlls/ole32/git.c b/dlls/ole32/git.c index e761c99b77c..fe6b5e58122 100644 --- a/dlls/ole32/git.c +++ b/dlls/ole32/git.c @@ -290,47 +290,38 @@ StdGlobalInterfaceTable_GetInterfaceFromGlobal( return S_OK; }
-HRESULT WINAPI GlobalInterfaceTable_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj) -{ - IGlobalInterfaceTable *git = get_std_git(); - HRESULT hr = IGlobalInterfaceTable_QueryInterface(git, riid, obj); - IGlobalInterfaceTable_Release(git); - return hr; -} - -/* Virtual function table */ static const IGlobalInterfaceTableVtbl StdGlobalInterfaceTableImpl_Vtbl = { - StdGlobalInterfaceTable_QueryInterface, - StdGlobalInterfaceTable_AddRef, - StdGlobalInterfaceTable_Release, - StdGlobalInterfaceTable_RegisterInterfaceInGlobal, - StdGlobalInterfaceTable_RevokeInterfaceFromGlobal, - StdGlobalInterfaceTable_GetInterfaceFromGlobal + StdGlobalInterfaceTable_QueryInterface, + StdGlobalInterfaceTable_AddRef, + StdGlobalInterfaceTable_Release, + StdGlobalInterfaceTable_RegisterInterfaceInGlobal, + StdGlobalInterfaceTable_RevokeInterfaceFromGlobal, + StdGlobalInterfaceTable_GetInterfaceFromGlobal };
-IGlobalInterfaceTable* get_std_git(void) +HRESULT WINAPI GlobalInterfaceTable_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj) { - if (!std_git) - { - StdGlobalInterfaceTableImpl* newGIT; - - newGIT = HeapAlloc(GetProcessHeap(), 0, sizeof(StdGlobalInterfaceTableImpl)); - if (!newGIT) return NULL; + StdGlobalInterfaceTableImpl *git;
- newGIT->IGlobalInterfaceTable_iface.lpVtbl = &StdGlobalInterfaceTableImpl_Vtbl; - list_init(&newGIT->list); - newGIT->nextCookie = 0xf100; /* that's where windows starts, so that's where we start */ - - if (InterlockedCompareExchangePointer((void**)&std_git, &newGIT->IGlobalInterfaceTable_iface, NULL)) + if (!std_git) { - HeapFree(GetProcessHeap(), 0, newGIT); + git = heap_alloc(sizeof(*git)); + if (!git) return E_OUTOFMEMORY; + + git->IGlobalInterfaceTable_iface.lpVtbl = &StdGlobalInterfaceTableImpl_Vtbl; + list_init(&git->list); + git->nextCookie = 0xf100; /* that's where windows starts, so that's where we start */ + + if (InterlockedCompareExchangePointer((void **)&std_git, &git->IGlobalInterfaceTable_iface, NULL)) + { + heap_free(git); + } + else + TRACE("Created the GIT %p\n", git); } - else - TRACE("Created the GIT at %p\n", newGIT); - }
- return std_git; + return IGlobalInterfaceTable_QueryInterface(std_git, riid, obj); }
void release_std_git(void)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=77033
Your paranoid android.
=== debiant (32 bit Chinese:China report) ===
ole32: clipboard.c:1529: Test failed: gle 5 clipboard.c:1531: Test failed: gle 1418 clipboard.c:1533: Test failed: gle 1418 clipboard.c:1544: Test failed: got 00000000 clipboard.c:1585: Test failed: tymed 1 clipboard.c:1588: Test failed: got 00000001 clipboard.c:1589: Test failed: cf 0001 clipboard.c:1593: Test failed: tymed 1 clipboard.c:1596: Test failed: got 00000001 clipboard.c:1597: Test failed: cf 0001 clipboard.c:1601: Test failed: tymed 1 clipboard.c:1604: Test failed: got 00000001 clipboard.c:1605: Test failed: cf 0001 clipboard.c:1609: Test failed: tymed 1 clipboard.c:1612: Test failed: got 00000001 clipboard.c:1614: Test failed: cf 0001 clipboard.c:1621: Test failed: got 00000001 clipboard.c:1623: Test failed: cf 0001 clipboard.c:1627: Test failed: tymed 1 clipboard.c:1630: Test failed: got 00000001 clipboard.c:1631: Test failed: cf 0001 clipboard.c:1635: Test failed: tymed 1 clipboard.c:1638: Test failed: got 00000001 clipboard.c:1639: Test failed: cf 0001 clipboard.c:1643: Test failed: tymed 1 clipboard.c:1658: Test failed: got 80040069 clipboard.c:1659: Test failed: got 0