Make sure to also copy the name of a global function when initializing a ScriptContext.
git-svn-id: http://voip.null.ro/svn/yate@6115 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
c69218bb11
commit
6061e9049e
|
@ -943,7 +943,7 @@ bool JsCode::initialize(ScriptContext* context) const
|
|||
continue;
|
||||
const JsFunction* jf = YOBJECT(JsFunction,op);
|
||||
if (jf) {
|
||||
JsObject* nf = jf->copy(context->mutex());
|
||||
JsObject* nf = jf->copy(context->mutex(),jf->getFunc()->name());
|
||||
context->params().setParam(new ExpWrapper(nf,op->name(),op->barrier()));
|
||||
}
|
||||
else
|
||||
|
@ -3383,12 +3383,12 @@ JsFunction::JsFunction(Mutex* mtx, const char* name, ObjList* args, long int lbl
|
|||
params().addParam("length",String(argc));
|
||||
}
|
||||
|
||||
JsObject* JsFunction::copy(Mutex* mtx) const
|
||||
JsObject* JsFunction::copy(Mutex* mtx, const char* name) const
|
||||
{
|
||||
ObjList args;
|
||||
for (ObjList* l = m_formal.skipNull(); l; l = l->skipNext())
|
||||
args.append(new String(l->get()->toString()));
|
||||
return new JsFunction(mtx,0,&args,label(),m_code);
|
||||
return new JsFunction(mtx,name,&args,label(),m_code);
|
||||
}
|
||||
|
||||
void JsFunction::init()
|
||||
|
|
|
@ -2231,7 +2231,16 @@ public:
|
|||
* @param mtx Pointer to the mutex that serializes the copied array
|
||||
* @return New object instance, does not keep references to old array
|
||||
*/
|
||||
virtual JsObject* copy(Mutex* mtx) const;
|
||||
inline JsObject* copy(Mutex* mtx) const
|
||||
{ return copy(mtx,0); }
|
||||
|
||||
/**
|
||||
* Deep copy method with given name
|
||||
* @param mtx Pointer to the mutex that serializes the copied array
|
||||
* @param name Name for the copied function
|
||||
* @return New object instance, does not keep references to old array
|
||||
*/
|
||||
virtual JsObject* copy(Mutex* mtx, const char* name) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue