Index: code/trunk/src/orxonox/GraphicsEngine.cc
===================================================================
--- code/trunk/src/orxonox/GraphicsEngine.cc	(revision 1034)
+++ code/trunk/src/orxonox/GraphicsEngine.cc	(revision 1035)
@@ -25,4 +25,5 @@
  *
  */
+
  /**
     @file orxonox.cc
Index: code/trunk/src/orxonox/GraphicsEngine.h
===================================================================
--- code/trunk/src/orxonox/GraphicsEngine.h	(revision 1034)
+++ code/trunk/src/orxonox/GraphicsEngine.h	(revision 1035)
@@ -1,5 +1,32 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007
+ *   Co-authors:
+ *      Reto Grieder
+ *
+ */
+
 /**
-  @file GraphicsEngine.h
-  @brief Graphics Engine
+  @file
+  @brief Declaration of GraphicsEngine Singleton.
   @author Benjamin Knecht <beni_at_orxonox.net>
  */
@@ -42,10 +69,11 @@
 
       static GraphicsEngine& getSingleton();
+      static GraphicsEngine* getSingletonPtr() { return &getSingleton(); }
 
     private:
       // don't mess with singletons
       GraphicsEngine();
+      ~GraphicsEngine();
       GraphicsEngine(GraphicsEngine&) { }
-      ~GraphicsEngine();
 
       //! Method called by the LogListener from Ogre
Index: code/trunk/src/orxonox/Orxonox.cc
===================================================================
--- code/trunk/src/orxonox/Orxonox.cc	(revision 1034)
+++ code/trunk/src/orxonox/Orxonox.cc	(revision 1035)
@@ -113,5 +113,5 @@
       delete this->orxonoxHUD_;
     Loader::close();
-    InputManager::destroySingleton();
+    InputManager::getSingleton().destroy();
     if (this->auMan_)
       delete this->auMan_;
@@ -329,5 +329,5 @@
   void Orxonox::setupInputSystem()
   {
-    inputHandler_ = InputManager::getSingleton();
+    inputHandler_ = &InputManager::getSingleton();
     if (!inputHandler_->initialise(ogre_->getWindowHandle(),
           ogre_->getWindowWidth(), ogre_->getWindowHeight()))
Index: code/trunk/src/orxonox/core/InputManager.cc
===================================================================
--- code/trunk/src/orxonox/core/InputManager.cc	(revision 1034)
+++ code/trunk/src/orxonox/core/InputManager.cc	(revision 1035)
@@ -43,5 +43,5 @@
     @brief The reference to the singleton
   */
-  InputManager* InputManager::singletonRef_s = 0;
+  //InputManager* InputManager::singletonRef_s = 0;
 
   /**
@@ -60,16 +60,15 @@
   InputManager::~InputManager()
   {
-    this->destroyDevices();
+    this->destroy();
   }
 
   /**
     @brief The one instance of the InputManager is stored in this function.
-    @return The pointer to the only instance of the InputManager
-  */
-  InputManager *InputManager::getSingleton()
-  {
-    if (!singletonRef_s)
-      singletonRef_s = new InputManager();
-    return singletonRef_s;
+    @return A reference to the only instance of the InputManager
+  */
+  InputManager& InputManager::getSingleton()
+  {
+    static InputManager theOnlyInstance;
+    return theOnlyInstance;
   }
 
@@ -142,9 +141,9 @@
 
   /**
-    @brief Destroys all the created input devices.
-  */
-  void InputManager::destroyDevices()
-  {
-    COUT(ORX_DEBUG) << "*** InputManager: Destroying InputManager..." << std::endl;
+    @brief Destroys all the created input devices and handlers.
+  */
+  void InputManager::destroy()
+  {
+    COUT(ORX_DEBUG) << "*** InputManager: Destroying ..." << std::endl;
     if (this->mouse_)
       this->inputSystem_->destroyInputObject(mouse_);
@@ -157,15 +156,17 @@
     this->keyboard_      = 0;
     this->inputSystem_   = 0;
+
+    if (this->handlerBuffer_)
+      delete this->handlerBuffer_;
+    if (this->handlerGame_)
+      delete this->handlerGame_;
+    if (this->handlerGUI_)
+      delete this->handlerGUI_;
+
+    this->handlerBuffer_ = 0;
+    this->handlerGame_   = 0;
+    this->handlerGUI_    = 0;
+
     COUT(ORX_DEBUG) << "*** InputManager: Destroying done." << std::endl;
-  }
-
-  /**
-    @brief Destroys the singleton.
-  */
-  void InputManager::destroySingleton()
-  {
-    if (singletonRef_s)
-      delete singletonRef_s;
-    singletonRef_s = 0;
   }
 
Index: code/trunk/src/orxonox/core/InputManager.h
===================================================================
--- code/trunk/src/orxonox/core/InputManager.h	(revision 1034)
+++ code/trunk/src/orxonox/core/InputManager.h	(revision 1035)
@@ -67,5 +67,5 @@
   public:
     bool initialise(size_t windowHnd, int windowWidth, int windowHeight);
-    void destroyDevices();
+    void destroy();
     void tick(float dt);
     void setWindowExtents(int width, int height);
@@ -77,6 +77,6 @@
     OIS::Keyboard *getKeyboard() { return this->keyboard_; }
 
-    static InputManager* getSingleton();
-    static void destroySingleton();
+    static InputManager& getSingleton();
+    static InputManager* getSingletonPtr() { return &getSingleton(); }
 
   private:
@@ -84,5 +84,4 @@
     InputManager ();
     InputManager (const InputManager&);
-    InputManager& operator=(const InputManager& instance);
     ~InputManager();
 
@@ -99,5 +98,5 @@
 
     //! Pointer to the instance of the singleton
-    static InputManager *singletonRef_s;
+    //static InputManager *singletonRef_s;
   };
 }
Index: code/trunk/src/orxonox/objects/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1034)
+++ code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1035)
@@ -417,9 +417,9 @@
     void SpaceShip::tick(float dt)
     {
-      if (InputManager::getSingleton()->getMouse()->getEventCallback() != this)
-        {
-            if (InputManager::getSingleton()->getMouse())
+      if (InputManager::getSingleton().getMouse()->getEventCallback() != this)
+        {
+            if (InputManager::getSingleton().getMouse())
             {
-                InputManager::getSingleton()->getMouse()->setEventCallback(this);
+                InputManager::getSingleton().getMouse()->setEventCallback(this);
                 this->setMouseEventCallback_ = true;
             }
@@ -446,6 +446,6 @@
         }
 
-        OIS::Keyboard* mKeyboard = InputManager::getSingleton()->getKeyboard();
-        OIS::Mouse* mMouse = InputManager::getSingleton()->getMouse();
+        OIS::Keyboard* mKeyboard = InputManager::getSingleton().getKeyboard();
+        OIS::Mouse* mMouse = InputManager::getSingleton().getMouse();
 
 
Index: code/trunk/visual_studio/vc8/orxonox.vcproj
===================================================================
--- code/trunk/visual_studio/vc8/orxonox.vcproj	(revision 1034)
+++ code/trunk/visual_studio/vc8/orxonox.vcproj	(revision 1035)
@@ -245,4 +245,12 @@
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|Win32"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+							/>
+						</FileConfiguration>
 					</File>
 					<File
@@ -257,4 +265,12 @@
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|Win32"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+							/>
+						</FileConfiguration>
 					</File>
 					<File
@@ -269,4 +285,12 @@
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|Win32"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+							/>
+						</FileConfiguration>
 					</File>
 					<File
@@ -281,4 +305,12 @@
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|Win32"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+							/>
+						</FileConfiguration>
 					</File>
 					<File
@@ -293,4 +325,12 @@
 							/>
 						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|Win32"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+							/>
+						</FileConfiguration>
 					</File>
 					<File
@@ -299,4 +339,12 @@
 						<FileConfiguration
 							Name="Debug|Win32"
+							ExcludedFromBuild="true"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|Win32"
 							ExcludedFromBuild="true"
 							>
