mirror of https://github.com/Icinga/icinga2.git
Make sure all constructors properly initialize the ScriptFrame object
refs #12408
This commit is contained in:
parent
c5a170a972
commit
9f67b185b8
|
@ -27,6 +27,17 @@ boost::thread_specific_ptr<std::stack<ScriptFrame *> > ScriptFrame::m_ScriptFram
|
|||
|
||||
ScriptFrame::ScriptFrame(void)
|
||||
: Locals(new Dictionary()), Self(ScriptGlobal::GetGlobals()), Sandboxed(false), Depth(0)
|
||||
{
|
||||
InitializeFrame();
|
||||
}
|
||||
|
||||
ScriptFrame::ScriptFrame(const Value& self)
|
||||
: Locals(new Dictionary()), Self(self), Sandboxed(false), Depth(0)
|
||||
{
|
||||
InitializeFrame();
|
||||
}
|
||||
|
||||
void ScriptFrame::InitializeFrame(void)
|
||||
{
|
||||
std::stack<ScriptFrame *> *frames = m_ScriptFrames.get();
|
||||
|
||||
|
@ -35,7 +46,9 @@ ScriptFrame::ScriptFrame(void)
|
|||
|
||||
Sandboxed = frame->Sandboxed;
|
||||
Imports = frame->Imports;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (!Imports) {
|
||||
Imports = new Array();
|
||||
Imports->Add(ScriptGlobal::Get("System"));
|
||||
}
|
||||
|
@ -43,12 +56,6 @@ ScriptFrame::ScriptFrame(void)
|
|||
PushFrame(this);
|
||||
}
|
||||
|
||||
ScriptFrame::ScriptFrame(const Value& self)
|
||||
: Locals(new Dictionary()), Self(self), Sandboxed(false), Depth(0)
|
||||
{
|
||||
PushFrame(this);
|
||||
}
|
||||
|
||||
ScriptFrame::~ScriptFrame(void)
|
||||
{
|
||||
ScriptFrame *frame = PopFrame();
|
||||
|
|
|
@ -51,6 +51,8 @@ private:
|
|||
|
||||
inline static void PushFrame(ScriptFrame *frame);
|
||||
inline static ScriptFrame *PopFrame(void);
|
||||
|
||||
void InitializeFrame(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue