fixes crash when callOnChildren

Anis and me managed to fix this: #1508
This commit is contained in:
Alex Piola 2016-03-04 18:03:21 +01:00
parent e9b0e966a3
commit 07cf85143b
2 changed files with 9 additions and 4 deletions

View file

@ -1252,7 +1252,7 @@ ConsoleValueRef _internalExecute(SimObject *object, S32 argc, ConsoleValueRef ar
if(object->getNamespace())
{
U32 ident = object->getId();
ConsoleValueRef oldIdent = argv[1];
ConsoleValueRef oldIdent(argv[1]);
StringTableEntry funcName = StringTable->insert(argv[0]);
Namespace::Entry *ent = object->getNamespace()->lookup(funcName);
@ -1266,7 +1266,9 @@ ConsoleValueRef _internalExecute(SimObject *object, S32 argc, ConsoleValueRef ar
}
// Twiddle %this argument
argv[1] = (S32)ident;
ConsoleValue func_ident;
func_ident.setIntValue((S32)ident);
argv[1] = ConsoleValueRef::fromValue(&func_ident);
SimObject *save = gEvalState.thisObject;
gEvalState.thisObject = object;

View file

@ -233,8 +233,11 @@ void SimSet::callOnChildren( const String &method, S32 argc, ConsoleValueRef arg
{
// Prep the arguments for the console exec...
// Make sure and leave args[1] empty.
ConsoleValueRef args[21];
args[0] = method.c_str();
ConsoleValueRef args[21] = { };
ConsoleValue name_method;
name_method.setStackStringValue(method.c_str());
args[0] = ConsoleValueRef::fromValue(&name_method);
for (S32 i = 0; i < argc; i++)
args[i + 2] = argv[i];