https://git.reactos.org/?p=reactos.git;a=commitdiff;h=757bed81b1c96bffa195b…
commit 757bed81b1c96bffa195b1237d6d91125a1650bf
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Jan 2 01:40:11 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Jan 2 01:40:11 2022 +0900
[NTUSER] Fix KVM and VBox tests (#4235)
KVM and VBox tests was failing since d5deacd
- Check NULL at UserFreeInputContext and UserDestroyInputContext functions.
- Move UserMarkObjectDestroy into the UserDestroyInputContext function.
CORE-11700
---
win32ss/user/ntuser/ime.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/win32ss/user/ntuser/ime.c b/win32ss/user/ntuser/ime.c
index c172f28a70c..81c4e330243 100644
--- a/win32ss/user/ntuser/ime.c
+++ b/win32ss/user/ntuser/ime.c
@@ -224,10 +224,14 @@ AllocInputContextObject(PDESKTOP pDesk,
VOID UserFreeInputContext(PVOID Object)
{
PIMC pIMC = Object, pImc0;
- PTHREADINFO pti = pIMC->head.pti;
+ PTHREADINFO pti;
- UserMarkObjectDestroy(Object);
+ if (!pIMC)
+ return;
+ pti = pIMC->head.pti;
+
+ /* Find the IMC in the list and remove it */
for (pImc0 = pti->spDefaultImc; pImc0; pImc0 = pImc0->pImcNext)
{
if (pImc0->pImcNext == pIMC)
@@ -237,7 +241,7 @@ VOID UserFreeInputContext(PVOID Object)
}
}
- UserHeapFree(Object);
+ UserHeapFree(pIMC);
pti->ppi->UserHandleCount--;
IntDereferenceThreadInfo(pti);
@@ -246,7 +250,11 @@ VOID UserFreeInputContext(PVOID Object)
BOOLEAN UserDestroyInputContext(PVOID Object)
{
PIMC pIMC = Object;
- UserDeleteObject(pIMC->head.h, TYPE_INPUTCONTEXT);
+ if (pIMC)
+ {
+ UserMarkObjectDestroy(pIMC);
+ UserDeleteObject(pIMC->head.h, TYPE_INPUTCONTEXT);
+ }
return TRUE;
}