changeset 293:66df2422a8b0

Added destructor to the routepathersearch class. Attempt to fix the memory leak reported by Unknown-Horizons.
author wenlin_fife@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 30 Jun 2009 20:03:02 +0000
parents 6362c6812580
children 7416088ab191
files engine/core/pathfinder/routepather/routepathersearch.cpp engine/core/pathfinder/routepather/routepathersearch.h
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/engine/core/pathfinder/routepather/routepathersearch.cpp	Fri Jun 26 18:04:57 2009 +0000
+++ b/engine/core/pathfinder/routepather/routepathersearch.cpp	Tue Jun 30 20:03:02 2009 +0000
@@ -55,6 +55,11 @@
              //   m_searchspace = searchSpace;
 	}
 
+        RoutePatherSearch::~RoutePatherSearch(){
+                 delete m_searchspace;
+                 delete m_heuristic;
+        }
+
 	void RoutePatherSearch::updateSearch() {
 		if(m_sortedfrontier.empty()) {
 			setSearchStatus(search_status_failed);
--- a/engine/core/pathfinder/routepather/routepathersearch.h	Fri Jun 26 18:04:57 2009 +0000
+++ b/engine/core/pathfinder/routepather/routepathersearch.h	Tue Jun 30 20:03:02 2009 +0000
@@ -47,6 +47,8 @@
 	public:
 		RoutePatherSearch(const int session_id, const Location& from, const Location& to, SearchSpace* searchSpace);
 
+                ~RoutePatherSearch();
+
                 typedef std::list<Location> Path;
                 /** An enumeration of the different status the search can be in.
                  *
@@ -95,6 +97,7 @@
                         m_status = status;
                 }
 
+         private:
                 //A location object representing where the search started.
                 Location                m_to;
 
@@ -110,7 +113,6 @@
                 //An enumeration of the searches current status.
                 SearchStatus    m_status;
 
-	private:
 		//The class to use to calculate the heuristic value.
 		Heuristic*                m_heuristic;
 		//The destination coordinate as an int.