ole32: Use get_stub_manager_from_object in CoDisconnectObject.
This commit is contained in:
parent
af944cefdf
commit
38a9a232f7
|
@ -2019,6 +2019,7 @@ void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
|
|||
*/
|
||||
HRESULT WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved )
|
||||
{
|
||||
struct stub_manager *manager;
|
||||
HRESULT hr;
|
||||
IMarshal *marshal;
|
||||
APARTMENT *apt;
|
||||
|
@ -2039,7 +2040,12 @@ HRESULT WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved )
|
|||
if (!apt)
|
||||
return CO_E_NOTINITIALIZED;
|
||||
|
||||
apartment_disconnectobject(apt, lpUnk);
|
||||
manager = get_stub_manager_from_object(apt, lpUnk, FALSE);
|
||||
if (manager) {
|
||||
/* Release stub manager twice, to remove the apartment reference. */
|
||||
stub_manager_int_release(manager);
|
||||
stub_manager_int_release(manager);
|
||||
}
|
||||
|
||||
/* Note: native is pretty broken here because it just silently
|
||||
* fails, without returning an appropriate error code if the object was
|
||||
|
|
|
@ -235,7 +235,6 @@ APARTMENT *apartment_findfromoxid(OXID oxid, BOOL ref) DECLSPEC_HIDDEN;
|
|||
APARTMENT *apartment_findfromtid(DWORD tid) DECLSPEC_HIDDEN;
|
||||
DWORD apartment_release(struct apartment *apt) DECLSPEC_HIDDEN;
|
||||
HRESULT apartment_disconnectproxies(struct apartment *apt) DECLSPEC_HIDDEN;
|
||||
void apartment_disconnectobject(struct apartment *apt, void *object) DECLSPEC_HIDDEN;
|
||||
static inline HRESULT apartment_getoxid(const struct apartment *apt, OXID *oxid)
|
||||
{
|
||||
*oxid = apt->oxid;
|
||||
|
|
|
@ -356,31 +356,6 @@ struct stub_manager *get_stub_manager_from_object(APARTMENT *apt, IUnknown *obj,
|
|||
return result;
|
||||
}
|
||||
|
||||
/* removes the apartment reference to an object, destroying it when no other
|
||||
* threads have a reference to it */
|
||||
void apartment_disconnectobject(struct apartment *apt, void *object)
|
||||
{
|
||||
BOOL found = FALSE;
|
||||
struct stub_manager *stubmgr;
|
||||
|
||||
EnterCriticalSection(&apt->cs);
|
||||
LIST_FOR_EACH_ENTRY( stubmgr, &apt->stubmgrs, struct stub_manager, entry )
|
||||
{
|
||||
if (stubmgr->object == object)
|
||||
{
|
||||
found = TRUE;
|
||||
stub_manager_int_release(stubmgr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection(&apt->cs);
|
||||
|
||||
if (found)
|
||||
TRACE("disconnect object %p\n", object);
|
||||
else
|
||||
WARN("couldn't find object %p\n", object);
|
||||
}
|
||||
|
||||
/* gets the stub manager associated with an object id - caller must have
|
||||
* a reference to the apartment while a reference to the stub manager is held.
|
||||
* it must also call release on the stub manager when it is no longer needed */
|
||||
|
|
Loading…
Reference in New Issue