title: How to switch Scene in Cocos2d-x
body: <p>I have 2 Scenes, "one scene is just an empty scene with a button" and "another scene has one TableView". I would like to switch back and forth, my code that is using to switch the scenes is 
  shown below:</p>
  
  <pre><code>scence1 to scene2
      auto scene2 = Scene2::createScene();
      Director::getInstance()-&gt;replaceScene(scene2);
  
  scene2 to scene1
      auto scene1 = Scene1::createScene();
      Director::getInstance()-&gt;replaceScene(scene1);
  </code></pre>
  
  <p>I suspect that TableViewCell make the program crashes.</p>
  
  <p>Here is my code to create TableView in scene2:</p>
  
  <pre><code>Size tvSize = Size(640.0, 640.0);
  _tableview = TableView::create(this, tvSize);
  _tableview-&gt;retain();
  _tableview-&gt;setDirection(cocos2d::extension::ScrollView::Direction::VERTICAL);
  _tableview-&gt;setPosition(Point(0.0 , 0.0 + ((640.0 - tvSize.height)/ 2.0)));
  _tableview-&gt;setDataSource(this);
  </code></pre>
  
  <p>Remarkable: cocos2d-x v3.0 beta</p>
  
  <p>UPDTE: 
     Thank you everyone for helping me, right now I be able to fix it,
  The caused of the error is I add this line:</p>
  
  <pre><code>_eventDispatcher-&gt;addEventListenerWithFixedPriority(listener, 1);
  </code></pre>
  
  <p>and forgot to add this line when we finish using _eventDispatcher:</p>
  
  <pre><code>_eventDispatcher-&gt;removeEventListener(_touchListener);
  </code></pre>