riched20: Don't take a ref on the text host.

This would result in the host and services objects holding
refs on each other.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-03-03 11:29:40 +00:00 committed by Alexandre Julliard
parent 83254bb318
commit 68523af9b0
3 changed files with 3 additions and 4 deletions

View File

@ -3221,7 +3221,6 @@ void ME_DestroyEditor(ME_TextEditor *editor)
DeleteObject(editor->hbrBackground);
if(editor->lpOleCallback)
IRichEditOleCallback_Release(editor->lpOleCallback);
ITextHost_Release(editor->texthost);
if (editor->reOle)
{
IUnknown_Release(editor->reOle);

View File

@ -602,6 +602,7 @@ static BOOL init_texthost(ITextServices **txtserv, ITextHost **ret)
ITextServices object. */
result = pCreateTextServices(NULL, &dummyTextHost->ITextHost_iface, &init);
ok(result == S_OK, "Did not return S_OK when created (result = %x)\n", result);
ok(dummyTextHost->refCount == 1, "host ref %d\n", dummyTextHost->refCount);
if (result != S_OK) {
CoTaskMemFree(dummyTextHost);
win_skip("CreateTextServices failed.\n");

View File

@ -38,7 +38,7 @@ struct text_services
ITextServices ITextServices_iface;
IUnknown *outer_unk;
LONG ref;
ITextHost *pMyHost;
ITextHost *host;
CRITICAL_SECTION csTxtSrv;
ME_TextEditor *editor;
char spare[256];
@ -385,8 +385,7 @@ HRESULT WINAPI CreateTextServices(IUnknown *pUnkOuter, ITextHost *pITextHost, I
InitializeCriticalSection(&ITextImpl->csTxtSrv);
ITextImpl->csTxtSrv.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ITextServicesImpl.csTxtSrv");
ITextImpl->ref = 1;
ITextHost_AddRef(pITextHost);
ITextImpl->pMyHost = pITextHost;
ITextImpl->host = pITextHost; /* Don't take a ref of the host - this would lead to a mutual dependency */
ITextImpl->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
ITextImpl->ITextServices_iface.lpVtbl = &textservices_vtbl;
ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE);