mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
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)
|
ScriptFrame::ScriptFrame(void)
|
||||||
: Locals(new Dictionary()), Self(ScriptGlobal::GetGlobals()), Sandboxed(false), Depth(0)
|
: 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();
|
std::stack<ScriptFrame *> *frames = m_ScriptFrames.get();
|
||||||
|
|
||||||
@ -35,7 +46,9 @@ ScriptFrame::ScriptFrame(void)
|
|||||||
|
|
||||||
Sandboxed = frame->Sandboxed;
|
Sandboxed = frame->Sandboxed;
|
||||||
Imports = frame->Imports;
|
Imports = frame->Imports;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (!Imports) {
|
||||||
Imports = new Array();
|
Imports = new Array();
|
||||||
Imports->Add(ScriptGlobal::Get("System"));
|
Imports->Add(ScriptGlobal::Get("System"));
|
||||||
}
|
}
|
||||||
@ -43,12 +56,6 @@ ScriptFrame::ScriptFrame(void)
|
|||||||
PushFrame(this);
|
PushFrame(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptFrame::ScriptFrame(const Value& self)
|
|
||||||
: Locals(new Dictionary()), Self(self), Sandboxed(false), Depth(0)
|
|
||||||
{
|
|
||||||
PushFrame(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
ScriptFrame::~ScriptFrame(void)
|
ScriptFrame::~ScriptFrame(void)
|
||||||
{
|
{
|
||||||
ScriptFrame *frame = PopFrame();
|
ScriptFrame *frame = PopFrame();
|
||||||
|
@ -51,6 +51,8 @@ private:
|
|||||||
|
|
||||||
inline static void PushFrame(ScriptFrame *frame);
|
inline static void PushFrame(ScriptFrame *frame);
|
||||||
inline static ScriptFrame *PopFrame(void);
|
inline static ScriptFrame *PopFrame(void);
|
||||||
|
|
||||||
|
void InitializeFrame(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user