Index: /code/branches/presentation2012merge/src/modules/tetris/Tetris.cc
===================================================================
--- /code/branches/presentation2012merge/src/modules/tetris/Tetris.cc	(revision 9327)
+++ /code/branches/presentation2012merge/src/modules/tetris/Tetris.cc	(revision 9328)
@@ -67,5 +67,5 @@
         RegisterObject(Tetris);
 
-        this->activeBrick_ = NULL;
+        this->activeBrick_ = 0;
 
         // Pre-set the timer, but don't start it yet.
@@ -76,5 +76,5 @@
         this->endGameCriteria_ = 0.0f;
         this->setHUDTemplate("TetrisHUD");
-        this->futureBrick_ = NULL;
+        this->futureBrick_ = 0;
     }
 
@@ -95,21 +95,18 @@
     void Tetris::cleanup()
     {
-        if (this->isInitialized())
-        {
-            if (this->activeBrick_)
-            {
-                this->activeBrick_->destroy();
-                this->activeBrick_ = NULL;
-            }
-            if (this->futureBrick_)
-            {
-                this->futureBrick_->destroy();
-                this->futureBrick_ = NULL;
-            }
-
-            for (std::list<TetrisStone*>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
-                (*it)->destroy();
-            this->stones_.clear();
-        }
+        if (this->activeBrick_)
+        {
+            this->activeBrick_->destroy();
+            this->activeBrick_ = 0;
+        }
+        if (this->futureBrick_)
+        {
+            this->futureBrick_->destroy();
+            this->futureBrick_ = 0;
+        }
+
+        for (std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
+            (*it)->destroy();
+        this->stones_.clear();
     }
 
@@ -129,9 +126,7 @@
                 this->findFullRows();
                 if(this->endGameCriteria_ < 0.1f) //end game if two bricks are created within a 0.1s interval.
-                {
                     this->end();
-                    return;
-                }
-                this->startBrick();
+                else
+                    this->startBrick();
                 this->endGameCriteria_ = 0.0f;
             }
@@ -148,5 +143,5 @@
             return false;
 
-        for(std::list<TetrisStone*>::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
+        for(std::list<SmartPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
         {
             const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
@@ -201,5 +196,5 @@
 
         // we use a reverse iterator because we have to check for collisions with the topmost stones first
-        for(std::list<TetrisStone*>::const_reverse_iterator it = this->stones_.rbegin(); it != this->stones_.rend(); ++it)
+        for(std::list<SmartPtr<TetrisStone> >::const_reverse_iterator it = this->stones_.rbegin(); it != this->stones_.rend(); ++it)
         {
             //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount());
@@ -364,5 +359,5 @@
         // Make the last brick to be created the active brick.
         this->activeBrick_ = this->futureBrick_;
-        this->futureBrick_ = NULL;
+        this->futureBrick_ = 0;
 
         // set its position
@@ -432,7 +427,7 @@
         {
             stonesPerRow = 0;
-            for(std::list<TetrisStone*>::iterator it = this->stones_.begin(); it != this->stones_.end(); )
-            {
-                std::list<TetrisStone*>::iterator it_temp = it++;
+            for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
+            {
+                std::list<SmartPtr<TetrisStone> >::iterator it_temp = it++;
                 correctPosition = static_cast<unsigned int>(((*it_temp)->getPosition().y - 5)/this->center_->getStoneSize());
                 if(correctPosition == row)
@@ -454,5 +449,5 @@
     void Tetris::clearRow(unsigned int row)
     {// clear the full row
-        for(std::list<TetrisStone*>::iterator it = this->stones_.begin(); it != this->stones_.end(); )
+        for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
         {
             if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row)
@@ -465,5 +460,5 @@
         }
       // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug.
-        for(std::list<TetrisStone*>::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
+        for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
         {
             if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) > row)
Index: /code/branches/presentation2012merge/src/modules/tetris/Tetris.h
===================================================================
--- /code/branches/presentation2012merge/src/modules/tetris/Tetris.h	(revision 9327)
+++ /code/branches/presentation2012merge/src/modules/tetris/Tetris.h	(revision 9328)
@@ -92,7 +92,7 @@
 
             WeakPtr<TetrisCenterpoint> center_; //!< The playing field.
-            std::list<TetrisStone*> stones_; //!< A list of all stones in play.
-            TetrisBrick* activeBrick_;
-            TetrisBrick* futureBrick_;
+            std::list<SmartPtr<TetrisStone> > stones_; //!< A list of all stones in play.
+            WeakPtr<TetrisBrick> activeBrick_;
+            WeakPtr<TetrisBrick> futureBrick_;
 
             Timer starttimer_; //!< A timer to delay the start of the game.
Index: /code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.cc
===================================================================
--- /code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.cc	(revision 9327)
+++ /code/branches/presentation2012merge/src/modules/tetris/TetrisBrick.cc	(revision 9328)
@@ -236,5 +236,5 @@
     {
         assert(this->tetris_);
-        for(unsigned int i = 0; i < brickStones_.size(); i++)
+        for(unsigned int i = 0; i < this->brickStones_.size(); i++)
         {
             this->brickStones_[i]->detachFromParent();
@@ -242,5 +242,5 @@
             this->brickStones_[i]->setPosition(this->getPosition()+this->tetris_->rotateVector(this->brickStones_[i]->getPosition(),this->rotationCount_ ));
         }
-
+        this->brickStones_.clear();
     }
 
