Jacek Caban : ole32: Use get_stub_manager_from_object in CoDisconnectObject.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Sep 4 07:03:43 CDT 2015
Module: wine
Branch: master
Commit: 38a9a232f7c079280a285cc50a3c18d18188e210
URL: http://source.winehq.org/git/wine.git/?a=commit;h=38a9a232f7c079280a285cc50a3c18d18188e210
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Sep 4 11:50:19 2015 +0200
ole32: Use get_stub_manager_from_object in CoDisconnectObject.
---
dlls/ole32/compobj.c | 8 +++++++-
dlls/ole32/compobj_private.h | 1 -
dlls/ole32/stubmanager.c | 25 -------------------------
3 files changed, 7 insertions(+), 27 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 23c825a..0d0459a 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -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
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h
index 9f56d47..c63d645 100644
--- a/dlls/ole32/compobj_private.h
+++ b/dlls/ole32/compobj_private.h
@@ -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;
diff --git a/dlls/ole32/stubmanager.c b/dlls/ole32/stubmanager.c
index 668d46f..30e2054 100644
--- a/dlls/ole32/stubmanager.c
+++ b/dlls/ole32/stubmanager.c
@@ -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 */
More information about the wine-cvs
mailing list