[BUG_FIXED] Fix function tip crash issue.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@420 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2009-02-07 15:15:58 +00:00
parent 9678cec404
commit 36ee1015ff

View File

@ -116,11 +116,16 @@ bool FunctionCallTip::getCursorFunction() {
int endpos = _pEditView->execute(SCI_GETLINEENDPOSITION, line); int endpos = _pEditView->execute(SCI_GETLINEENDPOSITION, line);
int len = endpos - startpos + 3; //also take CRLF in account, even if not there int len = endpos - startpos + 3; //also take CRLF in account, even if not there
int offset = _curPos - startpos; //offset is cursor location, only stuff before cursor has influence int offset = _curPos - startpos; //offset is cursor location, only stuff before cursor has influence
if (offset < 2) { const int maxLen = 128;
if ((offset < 2) || (len >= maxLen))
{
reset(); reset();
return false; //cannot be a func, need name and separator return false; //cannot be a func, need name and separator
} }
TCHAR * lineData = new TCHAR[len];
TCHAR lineData[maxLen] = TEXT("");
_pEditView->getLine(line, lineData, len); _pEditView->getLine(line, lineData, len);
//line aquired, find the functionname //line aquired, find the functionname
@ -227,7 +232,6 @@ bool FunctionCallTip::getCursorFunction() {
res = true; res = true;
} }
} }
delete [] lineData;
return res; return res;
} }