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
This commit is contained in:
Alexandre Julliard 2005-01-21 16:18:38 +00:00
parent 14b96358f8
commit 32d9dab38d
1 changed files with 10 additions and 5 deletions

View File

@ -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;
}