This commit is contained in:
Jeff Hutchinson 2021-04-02 00:57:49 -04:00
parent 02447f0996
commit f776e73b04
11 changed files with 50 additions and 54 deletions

View file

@ -633,6 +633,10 @@ void ExprEvalState::pushFrame(StringTableEntry frameName, Namespace *ns, S32 reg
AssertFatal(!newFrame.getCount(), "ExprEvalState::pushFrame - Dictionary not empty!");
ConsoleValue* consoleValArray = new ConsoleValue[registerCount];
localStack.push_back(ConsoleValueFrame(consoleValArray, false));
currentRegisterArray = &localStack.last();
#ifdef DEBUG_SPEW
validate();
#endif
@ -653,6 +657,13 @@ void ExprEvalState::popFrame()
stack[mStackDepth]->reset();
currentVariable = NULL;
const ConsoleValueFrame& frame = localStack.last();
localStack.pop_back();
if (!frame.isReference)
delete[] frame.values;
currentRegisterArray = localStack.size() ? &localStack.last() : NULL;
#ifdef DEBUG_SPEW
validate();
#endif
@ -1296,7 +1307,7 @@ ConsoleValue Namespace::Entry::execute(S32 argc, ConsoleValue *argv, ExprEvalSta
case StringCallbackType:
{
const char* str = cb.mStringCallbackFunc(state->thisObject, argc, argv);
result.setString(str, dStrlen(str));
result.setString(str);
break;
}
case IntCallbackType: