title: Cocos2dx restart scene crashing CCTextureCache
body: <p>In Cocos2dx on iOS I'm having trouble restarting the same scene.
  I'm looking to restart the same scene whenever the player dies. There are a lot of things happening on at start up so if possible I'd rather not try and manually reset all the game variables, clear cache ect.</p>
  
  <p>In the part that the player dies I do the following</p>
  
  <pre><code>cocos2d::CCScene *pScene = GameScene::scene();
  cocos2d::CCDirector::sharedDirector()-&gt;replaceScene(pScene);
  </code></pre>
  
  <p>But this leads to the following crash:</p>
  
  <pre><code>CCTextureCache::CCTextureCache()
  {
      CCAssert(g_sharedTextureCache == NULL, "Attempted to allocate a second instance of a singleton.");
      m_pTextures = new CCDictionary();
  }
  </code></pre>
  
  <p>Gamescene is inherits from CCLayer and its constructor looks like this.</p>
  
  <pre><code>CCScene* GameScene::scene()
  {
      CCScene *scene = CCScene::create();
      GameScene *layer = GameScene::create();
      scene-&gt;addChild(layer);     
      return scene;
  }
  </code></pre>
  
  <p>The app crashes on this line GameScene *layer = GameScene::create(); but I can't really follow it any further. Am I doing anything wrong in the replacing of the scene?</p>
  
  <p>Thanks for any help</p>