Zhiyi Zhang : msctf: Check TF_GetThreadMgr error in DocumentMgr_Destructor.

Alexandre Julliard julliard at winehq.org
Tue Aug 27 15:28:15 CDT 2019


Module: wine
Branch: master
Commit: 0bebbbaa51c7647389ef9ac886169f6037356460
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0bebbbaa51c7647389ef9ac886169f6037356460

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue Aug 27 21:06:41 2019 +0800

msctf: Check TF_GetThreadMgr error in DocumentMgr_Destructor.

Thread manager could be already destroyed when calling DocumentMgr_Destructor.
This removes the error dialog when closing Unreal Engine 4 games.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msctf/documentmgr.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c
index dd49cd0..44856db 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]);




More information about the wine-cvs mailing list