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,
{
STATUSWINDOWPART *part=NULL;
BOOL changed = FALSE;
INT oldStyle;
if (style & SBT_OWNERDRAW) {
TRACE("part %d, text %p\n",nPart,text);
......@@ -671,11 +672,15 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
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 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
/* 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 @@ STATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,
return TRUE;
}
if (part->text)
if (part->text && !(oldStyle & SBT_OWNERDRAW))
Free (part->text);
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