PDA

View Full Version : What can be causing this crash?


Wiz
09-24-2002, 11:46 PM
I have a crash that occurs in the function RemoveCurrent in linked_list.h. It seems to happen randomly, when you kill mobs basically. It doesn't always happen, and I've been completely unable to find some kind of connection between the mobs that cause it to crash.

It's crashing right at the line marked by the arrow below:


template<class TYPE>
void LinkedListIterator<TYPE>::RemoveCurrent(bool DeleteData)
{
ListElement<TYPE>* save;
if (list.first == current_element)
{
list.first = current_element->GetNext();
}
if (current_element->GetPrev() != 0)
{
current_element->GetPrev()->SetNext(current_element->GetNext());
}
if (current_element->GetNext() != 0)
{
current_element->GetNext()->SetPrev(current_element->GetPrev());
};
if (dir == FORWARD)
{
save = current_element->GetNext();
}
else
{
save = current_element->GetPrev();
}
current_element->SetNext(0);
current_element->SetPrev(0);
if (!DeleteData)
current_element->SetData(0);
delete current_element; <-- Here
current_element = save;
}


Removing that line obviously causes the entire thing to lock up in the while loop at Clear(). But I've managed to confirm that it is indeed this line. The element it is trying to delete DOES indeed exist, it's not referring to something empty.

I seriously can't see what could cause this. I badly need help.

Wiz
09-26-2002, 06:47 AM
This *only* happens with NPC's spawned by the spawner. I seriously don't get this. Can anyone help?