riched20: modify ME_CharFromPoint to work properly with password controls

Matt Finnicum mattfinn at gmail.com
Tue Aug 8 10:55:08 CDT 2006


Annnnd i suppose this should go to wine-patches. Same as the original
patch, but properly destroys the temporary string when it's no longer
needed.

Thanks,
--Matt

On 8/7/06, Matt Finnicum <mattfinn at gmail.com> wrote:
> Oops! Good Call, Phil.
>
> Attached is an updated patch.
> --Matt
>
> On 8/7/06, Phil Krylov <phil.krylov at gmail.com> wrote:
> > Hi Matt,
> >
> > On 07/08/06, Matt Finnicum <mattfinn at gmail.com> wrote:
> > > This patch modifies ME_CharFromPoint to work properly with password
> > > controls (the patch i sent in / got committed a couple days ago).
> >
> > Should not the temp string be freed afterwards?
> >
> > -- Ph.
> >
>
>
>
-------------- next part --------------
From 880850b5980515549833854c81e8d445cba758cb Mon Sep 17 00:00:00 2001
From: Matthew Finnicum <MattFinn at gmail.com>
Date: Mon, 7 Aug 2006 10:12:44 -0400
Subject: [PATCH] riched20: modify ME_CharFromPoint to work properly with password controls
---
 dlls/riched20/run.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index d74d68f..f9b1ef6 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -512,8 +512,20 @@ int ME_CharFromPoint(ME_TextEditor *edit
   }
   hDC = GetDC(editor->hWnd);
   hOldFont = ME_SelectStyleFont(editor, hDC, run->style);
-  GetTextExtentExPointW(hDC, run->strText->szData, run->strText->nLen,
-    cx, &fit, NULL, &sz);
+  
+  if (editor->cPasswordMask)
+  {
+    ME_String *strMasked = ME_MakeStringR(editor->cPasswordMask,ME_StrVLen(run->strText));
+    GetTextExtentExPointW(hDC, strMasked->szData, run->strText->nLen,
+      cx, &fit, NULL, &sz);
+    ME_DestroyString(strMasked);
+  }
+  else
+  {
+    GetTextExtentExPointW(hDC, run->strText->szData, run->strText->nLen,
+      cx, &fit, NULL, &sz);
+  }
+  
   ME_UnselectStyleFont(editor, hDC, run->style, hOldFont);
   ReleaseDC(editor->hWnd, hDC);
   return fit;
-- 
1.4.1.1



More information about the wine-patches mailing list