[Orxonox-commit 3791] r8471 - code/trunk/src/modules/portals

rgrieder at orxonox.net rgrieder at orxonox.net
Thu May 12 17:20:26 CEST 2011


Author: rgrieder
Date: 2011-05-12 17:20:25 +0200 (Thu, 12 May 2011)
New Revision: 8471

Modified:
   code/trunk/src/modules/portals/PortalEndPoint.cc
Log:
Fixed possible bug (avoid using 'this' in the initialiser list unless really necessary).
And fixed memory leak.

Modified: code/trunk/src/modules/portals/PortalEndPoint.cc
===================================================================
--- code/trunk/src/modules/portals/PortalEndPoint.cc	2011-05-12 15:14:49 UTC (rev 8470)
+++ code/trunk/src/modules/portals/PortalEndPoint.cc	2011-05-12 15:20:25 UTC (rev 8471)
@@ -13,16 +13,17 @@
 
     std::map<unsigned int, PortalEndPoint *> PortalEndPoint::idMap_s;
 
-    PortalEndPoint::PortalEndPoint(BaseObject* creator) : StaticEntity(creator), id_(0), trigger_(new DistanceMultiTrigger(this))
+    PortalEndPoint::PortalEndPoint(BaseObject* creator) : StaticEntity(creator), id_(0), trigger_(NULL)
     {
         RegisterObject(PortalEndPoint);
+        this->trigger_ = new DistanceMultiTrigger(this);
         this->trigger_->setName("portal");
         this->attach(trigger_);
     }
     
     PortalEndPoint::~PortalEndPoint()
     {
-    
+        delete this->trigger_;
     }
 
     void PortalEndPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)




More information about the Orxonox-commit mailing list