Skip to content

Commit

Permalink
Merge branch 'tf/LH-37v2/ScintillaEditView-hotspotstyle-memory-leak'
Browse files Browse the repository at this point in the history
* tf/LH-37v2/ScintillaEditView-hotspotstyle-memory-leak:
  ScintillaEditView.cpp: fix createHotSpotFromStyle mem leak
  • Loading branch information
Thell Fowler committed Feb 26, 2010
2 parents 5400b42 + 75c8448 commit db1b029
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2821,24 +2821,17 @@ void ScintillaEditView::createHotSpotFromStyle(Style& out_hotspot, int idStyleFr
// Joce: HACK HACK HACK HACK HACK :-/
// nativeLangEncoding should be made part of WcharMbcsConvertor
static int nativeLangEncodingCopy = -1;
if (nativeLangEncodingCopy >= 0 && nativeLangEncodingCopy != nativeLangEncoding)
if (nativeLangEncoding >= 0 && nativeLangEncodingCopy != nativeLangEncoding)
{
nativeLangEncodingCopy = nativeLangEncoding;
}
// End HACK

char fontNameA[128];

execute(SCI_STYLEGETFONT, idStyleFrom, (LPARAM)fontNameA);
TCHAR *generic_fontname = new TCHAR[128];
#ifdef UNICODE

WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
const wchar_t * fontNameW = wmc->char2wchar(fontNameA, nativeLangEncodingCopy);
lstrcpy(generic_fontname, fontNameW);
#else
lstrcpy(generic_fontname, fontNameA);
#endif
out_hotspot._fontName = generic_fontname;
out_hotspot._fontName = wmc->char2wchar(fontNameA, nativeLangEncodingCopy);

out_hotspot._fgColor = execute(SCI_STYLEGETFORE, idStyleFrom);
out_hotspot._bgColor = execute(SCI_STYLEGETBACK, idStyleFrom);
Expand Down

0 comments on commit db1b029

Please sign in to comment.