Signed-off-by: Sven Baars sven.wine@gmail.com --- dlls/riched20/richole.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index dc1a3b8405..59204f54a9 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -1006,21 +1006,38 @@ static HRESULT WINAPI IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj) { IRichEditOleImpl *This = impl_from_IRichEditOle(me); - return IUnknown_QueryInterface(This->outer_unk, riid, ppvObj); + if (This->outer_unk) + return IUnknown_QueryInterface(This->outer_unk, riid, ppvObj); + else + return IUnknown_QueryInterface(&This->IUnknown_inner, riid, ppvObj); }
static ULONG WINAPI IRichEditOle_fnAddRef(IRichEditOle *me) { IRichEditOleImpl *This = impl_from_IRichEditOle(me); - return IUnknown_AddRef(This->outer_unk); + + ULONG ref = IUnknown_AddRef(&This->IUnknown_inner); + if (This->outer_unk) + IUnknown_AddRef(This->outer_unk); + + TRACE ("%p ref=%u\n", This, ref); + + return ref; }
static ULONG WINAPI IRichEditOle_fnRelease(IRichEditOle *me) { IRichEditOleImpl *This = impl_from_IRichEditOle(me); - return IUnknown_Release(This->outer_unk); + + if (This->outer_unk) + IUnknown_Release(This->outer_unk); + ULONG ref = IUnknown_Release(&This->IUnknown_inner); + + TRACE ("%p ref=%u\n", This, ref); + + return ref; }
static HRESULT WINAPI @@ -5470,7 +5487,7 @@ LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *p if (outer_unk) reo->outer_unk = outer_unk; else - reo->outer_unk = &reo->IUnknown_inner; + reo->outer_unk = NULL; *ppvObj = &reo->IRichEditOle_iface;
return 1;