Aric Stewart : imm32: When updating a NULL HIMCC with NULL just return NULL . Handle the NULL HIMCC for the compstr when doing a ImmNotifyIME for a reset .

Alexandre Julliard julliard at winehq.org
Thu Jan 3 06:43:42 CST 2008


Module: wine
Branch: master
Commit: 1b997a9986ce7a23f8cf5cc30dd6c3aadd9134e3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1b997a9986ce7a23f8cf5cc30dd6c3aadd9134e3

Author: Aric Stewart <aric at codeweavers.com>
Date:   Wed Jan  2 13:34:46 2008 -0600

imm32: When updating a NULL HIMCC with NULL just return NULL. Handle the NULL HIMCC for the compstr when doing a ImmNotifyIME for a reset.

---

 dlls/imm32/imm.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index 4f5f658..58d0e3e 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -240,6 +240,9 @@ static HIMCC updateCompStr(HIMCC old, LPWSTR compstr, DWORD len)
 
     TRACE("%s, %i\n",debugstr_wn(compstr,len),len);
 
+    if (old == NULL && compstr == NULL && len == 0)
+        return NULL;
+
     if (old != NULL)
     {
         olddata = ImmLockIMCC(old);
@@ -373,6 +376,9 @@ static HIMCC updateResultStr(HIMCC old, LPWSTR resultstr, DWORD len)
 
     TRACE("%s, %i\n",debugstr_wn(resultstr,len),len);
 
+    if (old == NULL && resultstr == NULL && len == 0)
+        return NULL;
+
     if (old != NULL)
     {
         olddata = ImmLockIMCC(old);
@@ -1419,7 +1425,7 @@ BOOL WINAPI ImmNotifyIME(
                         pX11DRV_ForceXIMReset(root_context->IMC.hWnd);
                     {
                         HIMCC newCompStr;
-                        DWORD cplen;
+                        DWORD cplen = 0;
                         LPWSTR cpstr;
                         LPCOMPOSITIONSTRING cs = NULL;
                         LPBYTE cdata = NULL;
@@ -1429,11 +1435,14 @@ BOOL WINAPI ImmNotifyIME(
                         ImmDestroyIMCC(root_context->IMC.hCompStr);
                         root_context->IMC.hCompStr = newCompStr;
 
-                        cdata = ImmLockIMCC(root_context->IMC.hCompStr);
-                        cs = (LPCOMPOSITIONSTRING)cdata;
-                        cplen = cs->dwCompStrLen;
-                        cpstr = (LPWSTR)&(cdata[cs->dwCompStrOffset]);
-                        ImmUnlockIMCC(root_context->IMC.hCompStr);
+                        if (root_context->IMC.hCompStr)
+                        {
+                            cdata = ImmLockIMCC(root_context->IMC.hCompStr);
+                            cs = (LPCOMPOSITIONSTRING)cdata;
+                            cplen = cs->dwCompStrLen;
+                            cpstr = (LPWSTR)&(cdata[cs->dwCompStrOffset]);
+                            ImmUnlockIMCC(root_context->IMC.hCompStr);
+                        }
                         if (cplen > 0)
                         {
                             WCHAR param = cpstr[0];




More information about the wine-cvs mailing list