https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2b2366ab9012d4464e5de…
commit 2b2366ab9012d4464e5de88e5877e3e6f2a429eb
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Feb 15 19:07:50 2022 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Tue Feb 15 19:07:50 2022 +0900
[NTUSER] Improve UserFreeInputContext and UserDestroyInputContext
CORE-18044
---
win32ss/user/ntuser/ime.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/win32ss/user/ntuser/ime.c b/win32ss/user/ntuser/ime.c
index 14771e828ac..f29f4e4cfa4 100644
--- a/win32ss/user/ntuser/ime.c
+++ b/win32ss/user/ntuser/ime.c
@@ -1218,13 +1218,22 @@ AllocInputContextObject(PDESKTOP pDesk,
VOID UserFreeInputContext(PVOID Object)
{
- PIMC pIMC = Object;
+ PIMC pIMC = Object, *ppIMC;
PTHREADINFO pti;
if (!pIMC)
return;
+ /* Find the IMC in the list and remove it */
pti = pIMC->head.pti;
+ for (ppIMC = &pti->spDefaultImc; *ppIMC; ppIMC = &(*ppIMC)->pImcNext)
+ {
+ if (*ppIMC == pIMC)
+ {
+ *ppIMC = pIMC->pImcNext;
+ break;
+ }
+ }
ExFreePoolWithTag(pIMC, USERTAG_IME);
@@ -1234,25 +1243,13 @@ VOID UserFreeInputContext(PVOID Object)
BOOLEAN UserDestroyInputContext(PVOID Object)
{
- PIMC pIMC = Object, pImc0;
- PTHREADINFO pti;
+ PIMC pIMC = Object;
if (!pIMC)
return TRUE;
UserMarkObjectDestroy(pIMC);
- /* Find the IMC in the list and remove it */
- pti = pIMC->head.pti;
- for (pImc0 = pti->spDefaultImc; pImc0; pImc0 = pImc0->pImcNext)
- {
- if (pImc0->pImcNext == pIMC)
- {
- pImc0->pImcNext = pIMC->pImcNext;
- break;
- }
- }
-
return UserDeleteObject(pIMC->head.h, TYPE_INPUTCONTEXT);
}