Commit a7b621bd authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

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.
parent bcf0be6a
......@@ -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;
......
......@@ -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? */
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment