title: Vector iterator not dereferencable?
body: <p>I'm getting that error with this code:</p>
  
  <pre><code>for(std::vector&lt;AguiTimedEvent*&gt;::iterator it = timedEvents.begin();
      it != timedEvents.end();)
  {
      if((*it)-&gt;expired())
      {
          (*it)-&gt;timedEventCallback();
          delete (*it);
  
          it = timedEvents.erase(it);
      }
      else
          it++;
  }
  </code></pre>
  
  <p>What could be the problem?</p>
  
  <p>the timed event sometimes pushes a new one in when its callback is called, that might do it </p>
  
  <p>Thanks</p>