diff options
author | oharboe <oharboe> | 2009-08-16 11:37:03 +0000 |
---|---|---|
committer | oharboe <oharboe> | 2009-08-16 11:37:03 +0000 |
commit | d0c5df9ca126ccd1dbc40f75e33b016859d0bfe6 (patch) | |
tree | c3bef8ca2e069c56c74bac589d9fbc32f1ffec44 /jim.c | |
parent | 5d231b9a3cac7de53a7a4c8c6fc88ef96b26d40b (diff) | |
download | jimtcl-d0c5df9ca126ccd1dbc40f75e33b016859d0bfe6.zip jimtcl-d0c5df9ca126ccd1dbc40f75e33b016859d0bfe6.tar.gz jimtcl-d0c5df9ca126ccd1dbc40f75e33b016859d0bfe6.tar.bz2 |
2009-08-16 Steve Bennett <steveb@workware.net.au>
* jim.c/h: If an object is used in subst, then source, a crash will result
Diffstat (limited to 'jim.c')
-rw-r--r-- | jim.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -3012,6 +3012,7 @@ int SetScriptFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) script->commands = 0; script->token = NULL; script->cmdStruct = NULL; + script->substFlags = 0; script->inUse = 1; /* Try to get information about filename / line number */ if (objPtr->typePtr == &sourceObjType) { @@ -3116,12 +3117,15 @@ int SetScriptFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) Jim_FreeIntRep(interp, objPtr); Jim_SetIntRepPtr(objPtr, script); objPtr->typePtr = &scriptObjType; + return JIM_OK; } ScriptObj *Jim_GetScript(Jim_Interp *interp, Jim_Obj *objPtr) { - if (objPtr->typePtr != &scriptObjType) { + struct ScriptObj *script = Jim_GetIntRepPtr(objPtr); + + if (objPtr->typePtr != &scriptObjType || script->substFlags) { SetScriptFromAny(interp, objPtr); } return (ScriptObj*) Jim_GetIntRepPtr(objPtr); @@ -11617,7 +11621,7 @@ static int Jim_LoadCoreCommand(Jim_Interp *interp, int argc, static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { - int i, flags = 0; + int i, flags = JIM_SUBST_FLAG; Jim_Obj *objPtr; if (argc < 2) { |