diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 683e24d1c7a..c291e81c7eb 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -2234,7 +2234,7 @@ HRESULT WINAPI CoLockObjectExternal( if (fLock) stub_manager_ext_addref(stubmgr, 1); else - stub_manager_ext_release(stubmgr, 1); + stub_manager_ext_release(stubmgr, 1, fLastUnlockReleases); stub_manager_int_release(stubmgr); diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h index a542cc64d62..4d27bab0d10 100644 --- a/dlls/ole32/compobj_private.h +++ b/dlls/ole32/compobj_private.h @@ -187,7 +187,7 @@ ULONG stub_manager_int_addref(struct stub_manager *This); ULONG stub_manager_int_release(struct stub_manager *This); struct stub_manager *new_stub_manager(APARTMENT *apt, IUnknown *object); ULONG stub_manager_ext_addref(struct stub_manager *m, ULONG refs); -ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs); +ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL last_unlock_releases); struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, IUnknown *iptr, REFIID iid, MSHLFLAGS flags); struct ifstub *stub_manager_find_ifstub(struct stub_manager *m, REFIID iid, MSHLFLAGS flags); struct stub_manager *get_stub_manager(APARTMENT *apt, OID oid); diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c index 152647bca4b..cbe4a0f9402 100644 --- a/dlls/ole32/marshal.c +++ b/dlls/ole32/marshal.c @@ -1190,7 +1190,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); + stub_manager_ext_release(stubmgr, stdobjref.cPublicRefs, TRUE); stub_manager_int_release(stubmgr); return hres; diff --git a/dlls/ole32/stubmanager.c b/dlls/ole32/stubmanager.c index e5f8741e18c..e0b0007c9a3 100644 --- a/dlls/ole32/stubmanager.c +++ b/dlls/ole32/stubmanager.c @@ -253,7 +253,7 @@ ULONG stub_manager_ext_addref(struct stub_manager *m, ULONG refs) } /* remove some external references */ -ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs) +ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL last_unlock_releases) { ULONG rc; @@ -267,7 +267,7 @@ ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs) TRACE("removed %lu refs from %p (oid %s), rc is now %lu\n", refs, m, wine_dbgstr_longlong(m->oid), rc); - if (rc == 0) + if (rc == 0 && last_unlock_releases) stub_manager_int_release(m); return rc; @@ -537,7 +537,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); + stub_manager_ext_release(m, refs, TRUE); } /* is an ifstub table marshaled? */ @@ -717,7 +717,7 @@ static HRESULT WINAPI RemUnknown_RemRelease(IRemUnknown *iface, break; } - stub_manager_ext_release(stubmgr, InterfaceRefs[i].cPublicRefs); + stub_manager_ext_release(stubmgr, InterfaceRefs[i].cPublicRefs, TRUE); if (InterfaceRefs[i].cPrivateRefs) FIXME("Releasing %ld refs securely not implemented\n", InterfaceRefs[i].cPrivateRefs);