I have this piece of code. This is called once every frame
[source lang="cpp"] //While there is a message to deliver
while(messageQueue.top().dispatchTime<=currentTime && !messageQueue.empty())
{
//deliver the message
messageQueue.top().receiver->handleMessage(messageQueue.top());
//delete the message
messageQueue.pop();
}[/source]
This works fine in release, but when I run in debug mode, I soon get an assertion failure: "Debug Assertion Failed! vector iterator not dereferencable"
vector iterator not dereferencable
You should put the !messageQueue.empty() test before you attempt to dereference top(), in case the queue actually is empty which would mean that messageQueue.top().dispatchTime is trying to dereference end() iterator.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement