title: Object in map corrupted after retrieving from the map
body: <p>So I've completely edited my question.
  I have a <code>map</code> called <code>mTextMap</code> which contains:</p>
  
  <pre><code>typedef std::map&lt;const std::string, Text*&gt;      TextMap;
  TextMap mTextMap;
  </code></pre>
  
  <p>And I have the following methods:</p>
  
  <pre><code>void Foo::setUpGame()
  {
      Text text(1,2,3,4); //create a Text object
      mTextMap["MainText"] = &amp;text; //save it in the map!
  }
  
  Text&amp; Foo::getText(const std::string name)
  {
      auto i= mTextMap.find(name);
      return *(i-&gt;second); //Gets a reference to the Text that is inside the map
  }
  </code></pre>
  
  <p>Now if I use this way:</p>
  
  <pre><code>Foo foo;
  foo.setUpGame();
  
  Text&amp; myText = foo.getText("MainText"); // Why is this corrupted?
  </code></pre>
  
  <p>The object <code>myText</code> is completely corrupted!!</p>
  
  <p>Why is this happening?</p>