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:
parent
14b96358f8
commit
32d9dab38d
|
@ -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,9 +672,13 @@ 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)) {
|
||||||
|
if (part->text)
|
||||||
|
Free (part->text);
|
||||||
|
} else if (part->text == text)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
part->text = (LPWSTR)text;
|
part->text = (LPWSTR)text;
|
||||||
} else {
|
} else {
|
||||||
|
@ -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,
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue