[Orxonox-commit 3620] r8305 - code/trunk/src/modules/pickup

dafrick at orxonox.net dafrick at orxonox.net
Fri Apr 22 21:28:56 CEST 2011


Author: dafrick
Date: 2011-04-22 21:28:56 +0200 (Fri, 22 Apr 2011)
New Revision: 8305

Modified:
   code/trunk/src/modules/pickup/PickupCollection.cc
Log:
Fixing another potential memory leak.


Modified: code/trunk/src/modules/pickup/PickupCollection.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupCollection.cc	2011-04-22 18:43:36 UTC (rev 8304)
+++ code/trunk/src/modules/pickup/PickupCollection.cc	2011-04-22 19:28:56 UTC (rev 8305)
@@ -53,7 +53,7 @@
     @param creator
         The creator of the object.
     */
-    PickupCollection::PickupCollection(BaseObject* creator) : BaseObject(creator)
+    PickupCollection::PickupCollection(BaseObject* creator) : BaseObject(creator), pickupCollectionIdentifier_(NULL)
     {
         RegisterObject(PickupCollection);
 
@@ -69,7 +69,7 @@
     @brief
         Destructor. Iterates through all Pickupables this PickupCollection consists of and destroys them if they haven't been already.
     */
-    PickupCollection::~PickupCollection()
+    PickupCollection::~ PickupCollection()
     {
         // Destroy all Pickupables constructing this PickupCollection.
         for(std::vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
@@ -78,6 +78,9 @@
             (*it)->destroy();
         }
         this->pickups_.clear();
+        
+        if(this->pickupCollectionIdentifier_ != NULL)
+            delete this->pickupCollectionIdentifier_;
     }
 
     /**




More information about the Orxonox-commit mailing list