diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c index dd49cd022fa..44856db632b 100644 --- a/dlls/msctf/documentmgr.c +++ b/dlls/msctf/documentmgr.c @@ -77,11 +77,15 @@ static inline EnumTfContext *impl_from_IEnumTfContexts(IEnumTfContexts *iface) static void DocumentMgr_Destructor(DocumentMgr *This) { - ITfThreadMgr *tm; + ITfThreadMgr *tm = NULL; TRACE("destroying %p\n", This); TF_GetThreadMgr(&tm); - ThreadMgr_OnDocumentMgrDestruction(tm, &This->ITfDocumentMgr_iface); + if (tm) + { + ThreadMgr_OnDocumentMgrDestruction(tm, &This->ITfDocumentMgr_iface); + ITfThreadMgr_Release(tm); + } if (This->contextStack[0]) ITfContext_Release(This->contextStack[0]);