Added patch to avoid unloading msctf library while textservices are activated.

This commit is contained in:
Sebastian Lackner
2015-03-01 05:10:43 +01:00
parent 6cf3424356
commit 985f04d9ba
6 changed files with 112 additions and 16 deletions

View File

@@ -0,0 +1,35 @@
From 4bcc72aa747a76c9300fbbd59a3c629206a7a554 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 1 Mar 2015 05:05:04 +0100
Subject: msctf: Always use interlocked functions when accessing
MSCTF_refCount.
---
dlls/msctf/msctf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/msctf/msctf.c b/dlls/msctf/msctf.c
index 78992f7..231246a 100644
--- a/dlls/msctf/msctf.c
+++ b/dlls/msctf/msctf.c
@@ -110,7 +110,7 @@ static void ClassFactory_Destructor(ClassFactory *This)
{
TRACE("Destroying class factory %p\n", This);
HeapFree(GetProcessHeap(),0,This);
- MSCTF_refCount--;
+ InterlockedDecrement(&MSCTF_refCount);
}
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppvOut)
@@ -190,7 +190,7 @@ static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
This->ctor = ctor;
*ppvOut = This;
TRACE("Created class factory %p\n", This);
- MSCTF_refCount++;
+ InterlockedIncrement(&MSCTF_refCount);
return S_OK;
}
--
2.3.0

View File

@@ -0,0 +1,37 @@
From f103e65ee8d05b6688dcecb4da039b1bd5714eb9 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 1 Mar 2015 05:08:20 +0100
Subject: msctf: Avoid unloading library while textservices are activated.
Based on a patch by Qian Hong.
---
dlls/msctf/msctf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dlls/msctf/msctf.c b/dlls/msctf/msctf.c
index 231246a..1582ddd 100644
--- a/dlls/msctf/msctf.c
+++ b/dlls/msctf/msctf.c
@@ -445,6 +445,7 @@ HRESULT activate_textservices(ITfThreadMgr *tm)
if (activated > 1)
return S_OK;
+ InterlockedIncrement(&MSCTF_refCount);
LIST_FOR_EACH_ENTRY(ats, &AtsList, AtsEntry, entry)
{
hr = activate_given_ts(ats->ats, tm);
@@ -462,8 +463,11 @@ HRESULT deactivate_textservices(void)
activated --;
if (activated == 0)
+ {
LIST_FOR_EACH_ENTRY(ats, &AtsList, AtsEntry, entry)
deactivate_given_ts(ats->ats);
+ InterlockedDecrement(&MSCTF_refCount);
+ }
return S_OK;
}
--
2.3.0

View File

@@ -0,0 +1 @@
Fixes: [31579] Avoid unloading msctf library while textservices are activated