[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:00:05 CET 2013


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

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..b93dba7 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->Shutdown();
+}
+
 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