[icinga-checkins] icinga.org: icinga2/master: Properly shut down the interpreter when the Script object is being destroyed .

git at icinga.org git at icinga.org
Thu Feb 14 19:01:05 CET 2013


Module: icinga2
Branch: master
Commit: 2485a0469460aac40168bbe9b75fa5ba989af3bd
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=2485a0469460aac40168bbe9b75fa5ba989af3bd

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Thu Feb 14 18:59:47 2013 +0100

Properly shut down the interpreter when the Script object is being destroyed.

---

 lib/base/script.cpp |    6 ++++++
 lib/base/script.h   |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/base/script.cpp b/lib/base/script.cpp
index c324f98..abf1a6c 100644
--- a/lib/base/script.cpp
+++ b/lib/base/script.cpp
@@ -32,6 +32,12 @@ Script::Script(const Dictionary::Ptr& properties)
 	: DynamicObject(properties)
 { }
 
+Script::~Script(void)
+{
+	if (m_Interpreter)
+		m_Interpreter->Stop();
+}
+
 void Script::OnInitCompleted(void)
 {
 	SpawnInterpreter();
diff --git a/lib/base/script.h b/lib/base/script.h
index daaf288..3cae28e 100644
--- a/lib/base/script.h
+++ b/lib/base/script.h
@@ -37,6 +37,7 @@ public:
 	typedef weak_ptr<Script> WeakPtr;
 
 	Script(const Dictionary::Ptr& properties);
+	~Script(void);
 
 	String GetLanguage(void) const;
 	String GetCode(void) const;





More information about the icinga-checkins mailing list