Skip to content

Commit db1b029

Browse files
author
Thell Fowler
committed
Merge branch 'tf/LH-37v2/ScintillaEditView-hotspotstyle-memory-leak'
* tf/LH-37v2/ScintillaEditView-hotspotstyle-memory-leak: ScintillaEditView.cpp: fix createHotSpotFromStyle mem leak
2 parents 5400b42 + 75c8448 commit db1b029

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2821,24 +2821,17 @@ void ScintillaEditView::createHotSpotFromStyle(Style& out_hotspot, int idStyleFr
28212821
// Joce: HACK HACK HACK HACK HACK :-/
28222822
// nativeLangEncoding should be made part of WcharMbcsConvertor
28232823
static int nativeLangEncodingCopy = -1;
2824-
if (nativeLangEncodingCopy >= 0 && nativeLangEncodingCopy != nativeLangEncoding)
2824+
if (nativeLangEncoding >= 0 && nativeLangEncodingCopy != nativeLangEncoding)
28252825
{
28262826
nativeLangEncodingCopy = nativeLangEncoding;
28272827
}
28282828
// End HACK
28292829

28302830
char fontNameA[128];
2831-
28322831
execute(SCI_STYLEGETFONT, idStyleFrom, (LPARAM)fontNameA);
2833-
TCHAR *generic_fontname = new TCHAR[128];
2834-
#ifdef UNICODE
2832+
28352833
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
2836-
const wchar_t * fontNameW = wmc->char2wchar(fontNameA, nativeLangEncodingCopy);
2837-
lstrcpy(generic_fontname, fontNameW);
2838-
#else
2839-
lstrcpy(generic_fontname, fontNameA);
2840-
#endif
2841-
out_hotspot._fontName = generic_fontname;
2834+
out_hotspot._fontName = wmc->char2wchar(fontNameA, nativeLangEncodingCopy);
28422835

28432836
out_hotspot._fgColor = execute(SCI_STYLEGETFORE, idStyleFrom);
28442837
out_hotspot._bgColor = execute(SCI_STYLEGETBACK, idStyleFrom);

0 commit comments

Comments
 (0)