user32: Restore the len == 0 check which got lost in a previous patch

Dmitry Timoshkov dmitry at codeweavers.com
Wed Nov 22 01:18:07 CST 2006


Hello,

Changelog:
    user32: Restore the len == 0 check which got lost in a previous patch,
    make sure that we restore the DC state on STATIC_PaintRectfn exit.

---
 dlls/user32/static.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/static.c b/dlls/user32/static.c
index 1e6c1d9..3c9292b 100644
--- a/dlls/user32/static.c
+++ b/dlls/user32/static.c
@@ -682,14 +682,18 @@ static void STATIC_PaintTextfn( HWND hwn
     }
 
     buf_size = 256;
-    if (!(text = HeapAlloc( GetProcessHeap(), 0, buf_size * sizeof(WCHAR) ))) return;
+    if (!(text = HeapAlloc( GetProcessHeap(), 0, buf_size * sizeof(WCHAR) )))
+        goto no_TextOut;
 
     while ((len = InternalGetWindowText( hwnd, text, buf_size )) == buf_size - 1)
     {
         buf_size *= 2;
-        if (!(text = HeapReAlloc( GetProcessHeap(), 0, text, buf_size * sizeof(WCHAR) ))) return;
+        if (!(text = HeapReAlloc( GetProcessHeap(), 0, text, buf_size * sizeof(WCHAR) )))
+            goto no_TextOut;
     }
 
+    if (!len) goto no_TextOut;
+
     if (((style & SS_TYPEMASK) == SS_SIMPLE) && (style & SS_NOPREFIX))
     {
         /* Windows uses the faster ExtTextOut() to draw the text and
@@ -703,6 +707,7 @@ static void STATIC_PaintTextfn( HWND hwn
         DrawTextW( hdc, text, -1, &rc, wFormat );
     }
 
+no_TextOut:
     HeapFree( GetProcessHeap(), 0, text );
 
     if (hFont)
-- 
1.4.2






More information about the wine-patches mailing list