Commit 32d9dab3 authored by Alexandre Julliard's avatar Alexandre Julliard

Authors: Gunnar Dalsnes <hardon@online.no>, Ge van Geldorp <gvg@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 - free old text if new style is SBT_OWNERDRAW but old style wasn't
parent 14b96358
...@@ -650,6 +650,7 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style, ...@@ -650,6 +650,7 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
{ {
STATUSWINDOWPART *part=NULL; STATUSWINDOWPART *part=NULL;
BOOL changed = FALSE; BOOL changed = FALSE;
INT oldStyle;
if (style & SBT_OWNERDRAW) { if (style & SBT_OWNERDRAW) {
TRACE("part %d, text %p\n",nPart,text); TRACE("part %d, text %p\n",nPart,text);
...@@ -671,11 +672,15 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style, ...@@ -671,11 +672,15 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
if (part->style != style) if (part->style != style)
changed = TRUE; changed = TRUE;
oldStyle = part->style;
part->style = style; part->style = style;
if (style & SBT_OWNERDRAW) { if (style & SBT_OWNERDRAW) {
if (part->text == text) if (!(oldStyle & SBT_OWNERDRAW)) {
return TRUE; if (part->text)
part->text = (LPWSTR)text; Free (part->text);
} else if (part->text == text)
return TRUE;
part->text = (LPWSTR)text;
} else { } else {
LPWSTR ntext; LPWSTR ntext;
...@@ -694,7 +699,7 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style, ...@@ -694,7 +699,7 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
/* check if text is unchanged -> no need to redraw */ /* check if text is unchanged -> no need to redraw */
if (text) { if (text) {
if (!changed && part->text && !lstrcmpW(ntext, part->text)) { if (!changed && part->text && !lstrcmpW(ntext, part->text)) {
if (!isW) Free(ntext); Free(ntext);
return TRUE; return TRUE;
} }
} else { } else {
...@@ -702,7 +707,7 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style, ...@@ -702,7 +707,7 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
return TRUE; return TRUE;
} }
if (part->text) if (part->text && !(oldStyle & SBT_OWNERDRAW))
Free (part->text); Free (part->text);
part->text = ntext; part->text = ntext;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment