-2
我知道我正在做一些非常愚蠢的內存訪問方式,但無法弄清楚如何解決它。Segfault from Vector.end()?
if(isKeyDown("DERP"))
{
thisStack->pop();
}
調用
void aeonstack::pop()
{
if(!aeonstack::statestack.empty())
{
if(aeonstack::statestack.size()>1)
{
aeonstack::statestack.at(aeonstack::statestack.size()-1)->cleanUp();
aeonstack::statestack.pop_back();
}
else
{
aeon::log("WARNING: Tried to pop only state.");
}
}
else
{
aeon::log("WARNING: Tried to pop empty state stack.");
}
}
導致段錯誤。
完整的源代碼可在aeonsplice.com/segfault.zip
http://pastebin.com/RCB3A5EW – Athix
你應該發佈一個小而完整的例子來重現問題。 – juanchopanza