Rob Shearman : ole32: Fix behaviour of CoLockObjectExternal with fLastUnlockReleases as FALSE.
Alexandre Julliard
julliard at winehq.org
Tue Nov 24 12:40:21 CST 2009
Module: wine
Branch: master
Commit: a7b621bd9b9a5ca93feca3033cbf85739d414366
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a7b621bd9b9a5ca93feca3033cbf85739d414366
Author: Rob Shearman <robertshearman at gmail.com>
Date: Mon Nov 23 15:07:38 2009 +0000
ole32: Fix behaviour of CoLockObjectExternal with fLastUnlockReleases as FALSE.
The parameter controls whether weak references are ignored, not
whether the last stub_manager_int_release should be called when the
total reference count goes to zero.
---
dlls/ole32/marshal.c | 2 +-
dlls/ole32/stubmanager.c | 8 +++++---
dlls/ole32/tests/marshal.c | 3 ---
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c
index 821cb87..54a3a87 100644
--- a/dlls/ole32/marshal.c
+++ b/dlls/ole32/marshal.c
@@ -1336,7 +1336,7 @@ StdMarshalImpl_UnmarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, v
/* unref the ifstub. FIXME: only do this on success? */
if (!stub_manager_is_table_marshaled(stubmgr, &stdobjref.ipid))
- stub_manager_ext_release(stubmgr, stdobjref.cPublicRefs, stdobjref.flags & SORFP_TABLEWEAK, TRUE);
+ stub_manager_ext_release(stubmgr, stdobjref.cPublicRefs, stdobjref.flags & SORFP_TABLEWEAK, FALSE);
stub_manager_int_release(stubmgr);
return hres;
diff --git a/dlls/ole32/stubmanager.c b/dlls/ole32/stubmanager.c
index 12813c6..f6b8bfa 100644
--- a/dlls/ole32/stubmanager.c
+++ b/dlls/ole32/stubmanager.c
@@ -406,13 +406,15 @@ ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tablewea
rc = (m->extrefs -= refs);
if (tableweak)
- rc += --m->weakrefs;
+ --m->weakrefs;
+ if (!last_unlock_releases)
+ rc += m->weakrefs;
LeaveCriticalSection(&m->lock);
TRACE("removed %u refs from %p (oid %s), rc is now %u\n", refs, m, wine_dbgstr_longlong(m->oid), rc);
- if (rc == 0 && last_unlock_releases)
+ if (rc == 0)
stub_manager_int_release(m);
return rc;
@@ -551,7 +553,7 @@ void stub_manager_release_marshal_data(struct stub_manager *m, ULONG refs, const
else if (ifstub->flags & MSHLFLAGS_TABLESTRONG)
refs = 1;
- stub_manager_ext_release(m, refs, tableweak, TRUE);
+ stub_manager_ext_release(m, refs, tableweak, FALSE);
}
/* is an ifstub table marshaled? */
diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index 93fd9a6..bb2b508 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -1278,10 +1278,7 @@ static void test_lock_object_external(void)
CoLockObjectExternal((IUnknown*)&Test_ClassFactory, FALSE, FALSE);
- todo_wine
ok_no_locks();
- if (cLocks > 0)
- CoDisconnectObject((IUnknown*)&Test_ClassFactory, 0);
/* test CoLockObjectExternal doesn't release the last reference to an
* object with fLastUnlockReleases as TRUE and there is a weak reference
More information about the wine-cvs
mailing list