From 846093ea26a5be6724320fbb26954800e51729b8 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Fri, 10 Apr 2009 13:16:11 -0500 Subject: [PATCH] msctf: ITfDocumentMgr::GetBase returns the top if there is only one context pushed. --- dlls/msctf/documentmgr.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c index ab250cbb388..4ffd0b6f8b0 100644 --- a/dlls/msctf/documentmgr.c +++ b/dlls/msctf/documentmgr.c @@ -199,14 +199,21 @@ static HRESULT WINAPI DocumentMgr_GetTop(ITfDocumentMgr *iface, ITfContext **ppi static HRESULT WINAPI DocumentMgr_GetBase(ITfDocumentMgr *iface, ITfContext **ppic) { DocumentMgr *This = (DocumentMgr *)iface; + ITfContext *tgt; + TRACE("(%p)\n",This); if (!ppic) return E_INVALIDARG; if (This->contextStack[1]) - ITfContext_AddRef(This->contextStack[1]); + tgt = This->contextStack[1]; + else + tgt = This->contextStack[0]; - *ppic = This->contextStack[1]; + if (tgt) + ITfContext_AddRef(tgt); + + *ppic = tgt; return S_OK; }