From 36ee1015ff399df21618b826f16e358b86e2a93a Mon Sep 17 00:00:00 2001 From: donho Date: Sat, 7 Feb 2009 15:15:58 +0000 Subject: [PATCH] [BUG_FIXED] Fix function tip crash issue. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@420 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/ScitillaComponent/FunctionCallTip.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/FunctionCallTip.cpp b/PowerEditor/src/ScitillaComponent/FunctionCallTip.cpp index 98bf7ccf0..620fb4957 100644 --- a/PowerEditor/src/ScitillaComponent/FunctionCallTip.cpp +++ b/PowerEditor/src/ScitillaComponent/FunctionCallTip.cpp @@ -116,11 +116,16 @@ bool FunctionCallTip::getCursorFunction() { int endpos = _pEditView->execute(SCI_GETLINEENDPOSITION, line); 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 - if (offset < 2) { + const int maxLen = 128; + + if ((offset < 2) || (len >= maxLen)) + { reset(); return false; //cannot be a func, need name and separator } - TCHAR * lineData = new TCHAR[len]; + + TCHAR lineData[maxLen] = TEXT(""); + _pEditView->getLine(line, lineData, len); //line aquired, find the functionname @@ -227,7 +232,6 @@ bool FunctionCallTip::getCursorFunction() { res = true; } } - delete [] lineData; return res; }