dlls/comctl32/status.c (take 3)

Ge van Geldorp gvg at reactos.com
Fri Jan 21 04:39:18 CST 2005


Changelog:
  Gunnar Dalsnes <hardon at online.no>/Ge van Geldorp <gvg at reactos.com>
  STATUSBAR_SetTextT:
  - ntext wasn't freed on return if text was unicode
  - part->text was always freed, but if the previous style was SBT_OWNERDRAW,
    part->text would contain 32bit data (not a buffer ptr.)
  - free old text if new style is SBT_OWNERDRAW but old style wasn't

Index: dlls/comctl32/status.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/status.c,v
retrieving revision 1.69
diff -u -r1.69 status.c
--- dlls/comctl32/status.c	9 Jan 2005 16:42:54 -0000	1.69
+++ dlls/comctl32/status.c	21 Jan 2005 10:33:29 -0000
@@ -650,6 +650,7 @@
 {
     STATUSWINDOWPART *part=NULL;
     BOOL changed = FALSE;
+    INT  oldStyle;
 
     if (style & SBT_OWNERDRAW) {
          TRACE("part %d, text %p\n",nPart,text);
@@ -671,11 +672,15 @@
     if (part->style != style)
 	changed = TRUE;
 
+    oldStyle = part->style;
     part->style = style;
     if (style & SBT_OWNERDRAW) {
-	if (part->text == text)
-	    return TRUE;
-	part->text = (LPWSTR)text;
+        if (!(oldStyle & SBT_OWNERDRAW)) {
+            if (part->text)
+                Free (part->text);
+        } else if (part->text == text)
+            return TRUE;
+        part->text = (LPWSTR)text;
     } else {
 	LPWSTR ntext;
 
@@ -694,7 +699,7 @@
 	/* check if text is unchanged -> no need to redraw */
 	if (text) {
 	    if (!changed && part->text && !lstrcmpW(ntext, part->text)) {
-		if (!isW) Free(ntext);
+		Free(ntext);
 		return TRUE;
 	    }
 	} else {
@@ -702,7 +707,7 @@
 		return TRUE;
 	}
 
-	if (part->text)
+	if (part->text && !(oldStyle & SBT_OWNERDRAW))
 	    Free (part->text);
 	part->text = ntext;
     }



More information about the wine-patches mailing list