Index: generic/nsf.c =================================================================== diff -u -r8c4e49a8486b47ce8caa35e9e48343accc7f2764 -r82dad17164f1ed5c7a269724583aaad07f926e3c --- generic/nsf.c (.../nsf.c) (revision 8c4e49a8486b47ce8caa35e9e48343accc7f2764) +++ generic/nsf.c (.../nsf.c) (revision 82dad17164f1ed5c7a269724583aaad07f926e3c) @@ -23396,7 +23396,7 @@ ClientData runtimeState; int result, i; NsfRuntimeState *rst; - + #ifdef NSF_BYTECODE /*NsfCompEnv *interpstructions = NsfGetCompEnv();*/ #endif @@ -23478,11 +23478,16 @@ rst->doCheckResults = 1; rst->doCheckArguments = 1; - /* create nsf namespace */ - rst->NsfNS = Tcl_CreateNamespace(interp, "::nsf", NULL, (Tcl_NamespaceDeleteProc *)NULL); + /* + * check, if the namespace exists, otherwise create it. + */ + rst->NsfNS = Tcl_FindNamespace(interp, "::nsf", NULL, TCL_GLOBAL_ONLY); + if (rst->NsfNS == NULL) { + rst->NsfNS = Tcl_CreateNamespace(interp, "::nsf", NULL, + (Tcl_NamespaceDeleteProc *)NULL); + } + MEM_COUNT_ALLOC("TclNamespace", rst->NsfNS); - MEM_COUNT_ALLOC("TclNamespace", RUNTIME_STATE(interp)->NsfNS); - /* * init an empty, faked proc structure in the RUNTIME state */ @@ -23499,9 +23504,8 @@ rst->NsfClassesNS = Tcl_CreateNamespace(interp, "::nsf::classes", NULL, (Tcl_NamespaceDeleteProc *)NULL); - MEM_COUNT_ALLOC("TclNamespace", RUNTIME_STATE(interp)->NsfClassesNS); + MEM_COUNT_ALLOC("TclNamespace", rst->NsfClassesNS); - /* cache interpreters proc interpretation functions */ rst->objInterpProc = TclGetObjInterpProc(); rst->exitHandlerDestroyRound = NSF_EXITHANDLER_OFF; @@ -23614,10 +23618,12 @@ Tcl_Obj *varNameObj = Tcl_NewStringObj("::nsf::version",-1); Var *arrayPtr; + INCR_REF_COUNT(varNameObj); TclObjLookupVar(interp, varNameObj, NULL, 0, "access", /*createPart1*/ 1, /*createPart2*/ 1, &arrayPtr); Nsf_OT_parsedVarNameType = varNameObj->typePtr; assert(Nsf_OT_parsedVarNameType); + DECR_REF_COUNT(varNameObj); } #if !defined(TCL_THREADS)