src/node/application.cc
changeset 497 34d6f349478f
parent 493 68542941fc8a
child 517 702e96b8960f
--- a/src/node/application.cc	Wed May 02 22:32:25 2007 +0200
+++ b/src/node/application.cc	Wed May 02 23:08:41 2007 +0200
@@ -59,13 +59,31 @@
 // \brief Application Destructor
 Application::~Application()
 {
-  m_node->Unref ();
-  // Cancel the start/stop events if scheduled
-  if (m_start) Simulator::Cancel(m_startEvent);
-  if (m_stop)  Simulator::Cancel(m_stopEvent);
-  // Delete the random variablse
+  Dispose ();
+}
+
+void
+Application::Dispose (void)
+{
+  if (m_node != 0)
+    {
+      m_node->Unref ();
+      m_node = 0;
+    }
+  if (m_start) 
+    {
+      Simulator::Cancel(m_startEvent);
+      m_start = false;
+    }
+  if (m_stop) 
+    {
+      Simulator::Cancel(m_stopEvent);
+      m_stop = false;
+    }
   delete m_startVar;
+  m_startVar = 0;
   delete m_stopVar;
+  m_stopVar = 0;
 }
   
 Application& Application::operator=(const Application& rhs)