riched20: Fix IRichEditOle COM aggregation (Valgrind).
Signed-off-by: Sven Baars <sven.wine@gmail.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4f007da8d3
commit
d917f0ef09
|
@ -1124,6 +1124,7 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
|
|||
LPOLECLIENTSITE lpClientSite = NULL;
|
||||
LPDATAOBJECT lpDataObject = NULL;
|
||||
LPOLECACHE lpOleCache = NULL;
|
||||
LPRICHEDITOLE lpReOle = NULL;
|
||||
STGMEDIUM stgm;
|
||||
FORMATETC fm;
|
||||
CLSID clsid;
|
||||
|
@ -1156,7 +1157,8 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
|
|||
}
|
||||
|
||||
if (OleCreateDefaultHandler(&CLSID_NULL, NULL, &IID_IOleObject, (void**)&lpObject) == S_OK &&
|
||||
IRichEditOle_GetClientSite(editor->reOle, &lpClientSite) == S_OK &&
|
||||
IUnknown_QueryInterface(editor->reOle, &IID_IRichEditOle, (void**)&lpReOle) == S_OK &&
|
||||
IRichEditOle_GetClientSite(lpReOle, &lpClientSite) == S_OK &&
|
||||
IOleObject_SetClientSite(lpObject, lpClientSite) == S_OK &&
|
||||
IOleObject_GetUserClassID(lpObject, &clsid) == S_OK &&
|
||||
IOleObject_QueryInterface(lpObject, &IID_IOleCache, (void**)&lpOleCache) == S_OK &&
|
||||
|
@ -1188,6 +1190,7 @@ static HRESULT insert_static_object(ME_TextEditor *editor, HENHMETAFILE hemf, HB
|
|||
if (lpStorage) IStorage_Release(lpStorage);
|
||||
if (lpDataObject) IDataObject_Release(lpDataObject);
|
||||
if (lpOleCache) IOleCache_Release(lpOleCache);
|
||||
if (lpReOle) IRichEditOle_Release(lpReOle);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
@ -3215,7 +3218,7 @@ void ME_DestroyEditor(ME_TextEditor *editor)
|
|||
ITextHost_Release(editor->texthost);
|
||||
if (editor->reOle)
|
||||
{
|
||||
IRichEditOle_Release(editor->reOle);
|
||||
IUnknown_Release(editor->reOle);
|
||||
editor->reOle = NULL;
|
||||
}
|
||||
OleUninitialize();
|
||||
|
@ -4820,9 +4823,9 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
if (!editor->reOle)
|
||||
if (!CreateIRichEditOle(NULL, editor, (LPVOID *)&editor->reOle))
|
||||
return 0;
|
||||
*(LPVOID *)lParam = editor->reOle;
|
||||
IRichEditOle_AddRef(editor->reOle);
|
||||
return 1;
|
||||
if (IUnknown_QueryInterface(editor->reOle, &IID_IRichEditOle, (LPVOID *)lParam) == S_OK)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
case EM_GETPASSWORDCHAR:
|
||||
{
|
||||
|
|
|
@ -239,7 +239,6 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run* run, BOOL selected) DECLSPE
|
|||
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN;
|
||||
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN;
|
||||
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN;
|
||||
void ME_GetITextDocument2OldInterface(IRichEditOle *iface, LPVOID *ppvObj) DECLSPEC_HIDDEN;
|
||||
|
||||
/* editor.c */
|
||||
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -385,7 +385,7 @@ typedef struct tagME_TextEditor
|
|||
{
|
||||
HWND hWnd, hwndParent;
|
||||
ITextHost *texthost;
|
||||
IRichEditOle *reOle;
|
||||
IUnknown *reOle;
|
||||
BOOL bEmulateVersion10;
|
||||
ME_TextBuffer *pBuffer;
|
||||
ME_Cursor *pCursors;
|
||||
|
|
|
@ -5471,7 +5471,7 @@ LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *p
|
|||
reo->outer_unk = outer_unk;
|
||||
else
|
||||
reo->outer_unk = &reo->IUnknown_inner;
|
||||
*ppvObj = &reo->IRichEditOle_iface;
|
||||
*ppvObj = &reo->IUnknown_inner;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -5691,9 +5691,3 @@ void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags)
|
|||
IOleClientSite_AddRef(dst->polesite);
|
||||
}
|
||||
}
|
||||
|
||||
void ME_GetITextDocument2OldInterface(IRichEditOle *iface, LPVOID *ppvObj)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_IRichEditOle(iface);
|
||||
*ppvObj = &This->ITextDocument2Old_iface;
|
||||
}
|
||||
|
|
|
@ -83,10 +83,7 @@ static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID r
|
|||
if (!This->editor->reOle)
|
||||
if (!CreateIRichEditOle(This->outer_unk, This->editor, (void **)(&This->editor->reOle)))
|
||||
return E_OUTOFMEMORY;
|
||||
if (IsEqualIID(riid, &IID_ITextDocument) || IsEqualIID(riid, &IID_ITextDocument2Old))
|
||||
ME_GetITextDocument2OldInterface(This->editor->reOle, ppv);
|
||||
else
|
||||
*ppv = This->editor->reOle;
|
||||
return IUnknown_QueryInterface(This->editor->reOle, riid, ppv);
|
||||
} else {
|
||||
*ppv = NULL;
|
||||
FIXME("Unknown interface: %s\n", debugstr_guid(riid));
|
||||
|
|
Loading…
Reference in New Issue