Index: trunk/src/story_entities/game_world.cc
===================================================================
--- trunk/src/story_entities/game_world.cc	(revision 7286)
+++ trunk/src/story_entities/game_world.cc	(revision 7287)
@@ -20,4 +20,5 @@
 #include "game_world_data.h"
 
+#include "util/loading/resource_manager.h"
 #include "state.h"
 #include "class_list.h"
@@ -26,9 +27,15 @@
 #include "util/loading/game_loader.h"
 
+#include "p_node.h"
+#include "world_entity.h"
 #include "player.h"
 #include "camera.h"
 #include "environment.h"
 #include "terrain.h"
+#include "test_entity.h"
+#include "terrain.h"
 #include "md2Model.h"
+#include "world_entities/projectiles/projectile.h"
+#include "npcs/npc_test1.h"
 #include "playable.h"
 
@@ -40,5 +47,4 @@
 #include "shell_command.h"
 
-#include "util/loading/resource_manager.h"
 #include "graphics_engine.h"
 #include "event_handler.h"
@@ -47,4 +53,5 @@
 #include "network_manager.h"
 #include "physics_engine.h"
+#include "fields.h"
 
 #include "glmenu_imagescreen.h"
@@ -96,9 +103,6 @@
   PRINTF(4)("Deleted GameWorld\n");
 
-  this->bRunning = false;
-  this->unloadData();
-
-  if( this->dataTank)
-    delete this->dataTank;
+  if (this->audioThread != NULL)
+    SDL_KillThread(this->audioThread);
 }
 
@@ -136,16 +140,11 @@
   GameWorld* gw = (GameWorld*)gameWorld;
   printf("STARTIG AUDIO THREAD\n");
-  if(gw->dataTank != NULL && gw->dataTank->music != NULL)
-    gw->dataTank->music->playback();
-  SDL_Delay(100);
   while (gw->bRunning)
   {
-    printf("PLAYBACK\n");
-    ClassList::debug(3, CL_SOUND_OGG_PLAYER);
-    if(gw->dataTank != NULL && gw->dataTank->music != NULL)
-      gw->dataTank->music->update();
+    if(gw->dataTank->music != NULL)
+      gw->dataTank->music->playback();
     SDL_Delay(5);
   }
-  printf("END the AudioThread\n");
+  printf("End the AudioThread\n");
 }
 
@@ -169,13 +168,14 @@
   }
 
-  TiXmlDocument XMLDoc = TiXmlDocument( getLoadFile());
+  TiXmlDocument* XMLDoc = new TiXmlDocument( getLoadFile());
   // load the xml world file for further loading
-  if( !XMLDoc.LoadFile())
-  {
-    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc.ErrorDesc(), this->getLoadFile().c_str(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol());
+  if( !XMLDoc->LoadFile())
+  {
+    PRINTF(1)("loading XML File: %s @ %s:l%d:c%d\n", XMLDoc->ErrorDesc(), this->getLoadFile().c_str(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
+    delete XMLDoc;
     return (ErrorMessage){213,"XML File parsing error","GameWorld::load()"};
   }
   // check basic validity
-  TiXmlElement* root = XMLDoc.RootElement();
+  TiXmlElement* root = XMLDoc->RootElement();
   assert( root != NULL);
   if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile"))
@@ -183,4 +183,5 @@
     // report an error
     PRINTF(1)("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n");
+    delete XMLDoc;
     return (ErrorMessage){213,"Path not a WorldDataFile","GameWorld::load()"};
   }
@@ -189,4 +190,5 @@
   this->dataXML = (TiXmlElement*)root->Clone();
 
+  delete XMLDoc;
   this->releaseLoadScreen();
 }
@@ -199,15 +201,5 @@
 {
   delete this->shell;
-  this->shell = NULL;
-  PRINTF(0)("GameWorld::~unloadData() - unloading the current GameWorld %s::%s\n", this->getClassName(), this->getName());
-
-  if (this->audioThread != NULL)
-  {
-    this->bRunning = false;
-    SDL_WaitThread(this->audioThread, NULL);
-    this->audioThread = NULL;
-  }
-
-  ClassList::debug( 3, CL_GAME_WORLD_DATA);
+  PRINTF(3)("GameWorld::~GameWorld() - unloading the current GameWorld\n");
 
   this->dataTank->unloadData();
@@ -215,8 +207,5 @@
   State::setCurrentStoryEntity(NULL);
   if (this->dataXML)
-  {
     delete this->dataXML;
-    this->dataXML = NULL;
-  }
 }
 
@@ -244,4 +233,7 @@
   PRINTF(3)("GameWorld::stop() - got stop signal\n");
   this->bRunning = false;
+
+//  SDL_KillThread(this->audioThread);
+  this->audioThread = NULL;
 }
 
@@ -404,4 +396,7 @@
   PNode::getNullParent()->updateNode (this->dtS);
   SoundEngine::getInstance()->update();
+
+  if (this->dataTank->music != NULL)
+    this->dataTank->music->update();
 }
 
Index: trunk/src/story_entities/game_world_data.cc
===================================================================
--- trunk/src/story_entities/game_world_data.cc	(revision 7286)
+++ trunk/src/story_entities/game_world_data.cc	(revision 7287)
@@ -28,10 +28,16 @@
 #include "util/loading/game_loader.h"
 
+#include "p_node.h"
 #include "world_entity.h"
 #include "player.h"
 #include "camera.h"
 #include "environment.h"
+#include "terrain.h"
+#include "test_entity.h"
+#include "terrain.h"
 #include "skybox.h"
-#include "terrain.h"
+#include "md2Model.h"
+#include "world_entities/projectiles/projectile.h"
+#include "npcs/npc_test1.h"
 #include "playable.h"
 
@@ -119,5 +125,5 @@
  * @param root reference to the xml root element
  */
-ErrorMessage GameWorldData::loadData(const TiXmlElement* root)
+ErrorMessage GameWorldData::loadData(TiXmlElement* root)
 {
   // load the parameters
@@ -153,7 +159,7 @@
  * @param root reference to the xml root element
  */
-ErrorMessage GameWorldData::loadGUI(const TiXmlElement* root)
-{
-  const TiXmlElement* element = root->FirstChildElement("LoadScreen");
+ErrorMessage GameWorldData::loadGUI(TiXmlElement* root)
+{
+  TiXmlElement* element = root->FirstChildElement("LoadScreen");
   if( element == NULL)
   {
@@ -186,7 +192,7 @@
  * @param root reference to the xml root parameter
  */
-ErrorMessage GameWorldData::loadWorldEntities(const TiXmlElement* root)
-{
-  const TiXmlElement* element = root->FirstChildElement("WorldEntities");
+ErrorMessage GameWorldData::loadWorldEntities(TiXmlElement* root)
+{
+  TiXmlElement* element = root->FirstChildElement("WorldEntities");
 
   if( element == NULL)
@@ -204,10 +210,4 @@
       if( created != NULL )
         PRINTF(4)("Created a %s: %s\n", created->getClassName(), created->getName());
-      else
-      {
-        PRINTF(2)("Unable to create a %s\n", element->Value());
-        element = element->NextSiblingElement();
-        continue;
-      }
 
       //todo do this more elegant
@@ -310,5 +310,5 @@
  * @param root reference to the xml root element
  */
-ErrorMessage GameWorldData::loadScene(const TiXmlElement* root)
+ErrorMessage GameWorldData::loadScene(TiXmlElement* root)
 {
   LoadParamXML(root, "LightManager", LightManager::getInstance(), LightManager, loadParams);
@@ -342,6 +342,7 @@
   delete PhysicsEngine::getInstance();
 
-  this->setSoundTrack("");
-
+  if (this->music != NULL)
+    this->setSoundTrack("");
+  this->music = NULL;
   /* stop the sound eninge */
   SoundEngine::getInstance()->flushAllBuffers();
@@ -356,12 +357,6 @@
 {
   if (this->music != NULL)
-  {
-    OggPlayer* oldMusic = this->music;
-    this->music = NULL;
-    delete oldMusic;
-  }
-
-
-  PRINTF(0)("Setting Sound Track to %s\n", name.c_str());
+    delete this->music;
+  this->music = NULL;
 
   if (!name.empty())
@@ -369,6 +364,5 @@
     PRINTF(3)("Setting Sound Track to %s\n", name.c_str());
     std::string oggFile = ResourceManager::getFullName(name);
-    OggPlayer* newMusic = new OggPlayer(oggFile);
-    this->music = newMusic;
+    this->music = new OggPlayer(oggFile);
 
     //(OggPlayer*)ResourceManager::getInstance()->load(name, OGG, RP_LEVEL);
Index: trunk/src/story_entities/game_world_data.h
===================================================================
--- trunk/src/story_entities/game_world_data.h	(revision 7286)
+++ trunk/src/story_entities/game_world_data.h	(revision 7287)
@@ -38,5 +38,5 @@
 
     virtual ErrorMessage init();
-    virtual ErrorMessage loadData(const TiXmlElement* root);
+    virtual ErrorMessage loadData(TiXmlElement* root);
     virtual ErrorMessage unloadData();
 
@@ -46,7 +46,7 @@
 
   protected:
-    virtual ErrorMessage loadGUI(const TiXmlElement* root);
-    virtual ErrorMessage loadWorldEntities(const TiXmlElement* root);
-    virtual ErrorMessage loadScene(const TiXmlElement* root);
+    virtual ErrorMessage loadGUI(TiXmlElement* root);
+    virtual ErrorMessage loadWorldEntities(TiXmlElement* root);
+    virtual ErrorMessage loadScene(TiXmlElement* root);
 
     virtual ErrorMessage unloadGUI();
Index: trunk/src/story_entities/multi_player_world.cc
===================================================================
--- trunk/src/story_entities/multi_player_world.cc	(revision 7286)
+++ trunk/src/story_entities/multi_player_world.cc	(revision 7287)
@@ -57,4 +57,6 @@
 {
   PRINTF(3)("MultiPlayerWorld::~MultiPlayerWorld() - deleting current world\n");
+  if( this->dataTank)
+    delete this->dataTank;
 }
 
Index: trunk/src/story_entities/simple_game_menu.cc
===================================================================
--- trunk/src/story_entities/simple_game_menu.cc	(revision 7286)
+++ trunk/src/story_entities/simple_game_menu.cc	(revision 7287)
@@ -79,4 +79,7 @@
 {
   PRINTF(3)("SimpleGameMenu::~SimpleGameMenu() - deleting current world\n");
+
+  if( this->dataTank)
+    delete this->dataTank;
 }
 
Index: trunk/src/story_entities/single_player_world.cc
===================================================================
--- trunk/src/story_entities/single_player_world.cc	(revision 7286)
+++ trunk/src/story_entities/single_player_world.cc	(revision 7287)
@@ -59,4 +59,7 @@
 {
   PRINTF(3)("SinglePlayerWorld::~SinglePlayerWorld() - deleting current world\n");
+
+  if( this->dataTank)
+    delete this->dataTank;
 }
 
