PDA

View Full Version : Delete crashes?!


Wiz
09-27-2002, 01:05 AM
Alright... I'm having the weirdest problem. Several code snippets are crashing when they use the delete function. I posted about this a bunch of times earlier, though I didn't figure out exactly what was causing it until now.

Examples:

WesQuests.cpp


#ifdef WIN32
delete command; <-- Here
delete temp; <-- Here
#endif



linked_list.h


current_element->SetNext(0);
current_element->SetPrev(0);
if (!DeleteData)
current_element->SetData(0);
delete current_element; <-- Here


The marked lines cause crashes. Oddly enough, the linked_list.h crash only appears occasionaly, while the quest crash appears every time.

I am seriously confused by this, it's making no sense. Can anyone help?

DeletedUser
09-27-2002, 02:23 AM
you cant delete something that has already been deleted or does not exist, thats the reasons it would crash

Trumpcard
09-27-2002, 02:43 AM
Not a very good linked list if it doesnt account for hitting the end of the list traversal...

Wiz
09-27-2002, 06:45 AM
Image - I know. It exists. I even had the program cout some values right before the deleting to make sure it existed.

Last crash time, the entity was a_kobold04 (warrens) and the WesQuests entries were:

SAY: and SAY:Good job! That giant won't cause us any more problems.

Wiz
09-27-2002, 07:39 AM
cout<<"Next: "<<current_element->GetNext()<<endl;
cout<<"Prev: "<<current_element->GetPrev()<<endl;
current_element->SetNext(0);
current_element->SetPrev(0);
if (!DeleteData)
current_element->SetData(0);
cout<<"Current: "<<current_element->GetData()<<endl;
delete current_element;
cout<<"Completed delete!"<<endl;

That's the current code.

This is the error report before crash:

Message:----SERVER SHUTDOWN----
Zone shutdown: going to sleep
Deleting Nemmy the Mad`s_pet001
Next: 0x0103EE70
Prev: 0x00000000
Current: 0x01041C80
Completed delete!
Done
Deleting Lady Rosaline000
Next: 0x0103D7D0
Prev: 0x00000000
Current: 0x0103D3A0
Completed delete!
Done
Deleting Adrecia Tru`Ril000
Next: 0x0103DFE0
Prev: 0x00000000
Current: 0x0103DB80
Completed delete!
Done
Deleting Lord Za`Yth000
Next: 0x0103C8D0
Prev: 0x00000000
Current: 0x0103C490
Completed delete!
Done
Deleting Liam the Destroyer000
Next: 0x0103B080
Prev: 0x00000000
Current: 0x0103CC80
Completed delete!
Done
Deleting Nemmy the Mad000
Next: 0x0103BB30
Prev: 0x00000000
Current: 0x0103B670
Completed delete!
Done
Deleting Lady Lazuli000
Next: 0x0103A420
Prev: 0x00000000
Current: 0x0103BC80
Completed delete!
Done
Deleting Demitri Eto000
Next: 0x0103AD40
Prev: 0x00000000
Current: 0x0103A9C0
Completed delete!
Done
Deleting an azure drake014
Next: 0x010395C0
Prev: 0x00000000
Current: 0x01039190
Completed delete!
Done
Deleting a skyripper wyvern011
Next: 0x01038050
Prev: 0x00000000
Current: 0x01039A40
Completed delete!
Done
Deleting a crystal wyrm014
Next: 0x01038620
Prev: 0x00000000
Current: 0x010382A0
Completed delete!
Done
Deleting a crystal wyrm013
Next: 0x01038E90
Prev: 0x00000000
Current: 0x01038A60
Completed delete!
Done
Deleting an ancient rhino020
Next: 0x010373D0
Prev: 0x00000000
Current: 0x01037050
Completed delete!
Done
Deleting an ice burrower000
Next: 0x01037BE0
Prev: 0x00000000
Current: 0x01037860
Completed delete!
Done
Deleting a stormwolf025
Next: 0x01036430
Prev: 0x00000000
Current: 0x010360B0
Completed delete!
Done
Deleting a stormwolf024
Next: 0x01036C70
Prev: 0x00000000
Current: 0x010368F0
Completed delete!
Done
Deleting a stormwolf023
Next: 0x01035490
Prev: 0x00000000
Current: 0x01035110
Completed delete!
Done
Deleting a stormwolf022
Next: 0x01035CD0
Prev: 0x00000000
Current: 0x01035950
Completed delete!
Done
Deleting an ancient rhino019
Next: 0x01034550
Prev: 0x00000000
Current: 0x01034120
Completed delete!
Done
Deleting an ancient rhino018
Next: 0x01034D80
Prev: 0x00000000
Current: 0x01034A00
Completed delete!
Done
Deleting an ancient rhino017
Next: 0x010335E0
Prev: 0x00000000
Current: 0x01033260
Completed delete!
Done
Deleting a skyripper wyvern010
Next: 0x010320A0
Prev: 0x00000000
Current: 0x01033A20
Message:ZONEWIDE_MESSAGE: This zone caused a fatal error and will shut down now.
Your character will be restored to the last saved status. We are sorry for any
inconvenience!

So as you can see, it's not caused by missing data. And it's crashing exactly on the delete line.

Oh, and here's the crash code:

2002/09/27 19:37:43 GMT: Zone 7995 crashed. Errorcode: 2/0. Current zone loaded:westwastes. Current clients:0. Caused by:

Trumpcard
09-27-2002, 07:58 AM
Is that the last member of the linked list?

I'd write out a quick function to transverse the list till it hit null, and list the L.L. 's contents, then verify where it's bombing at.

Wiz
09-27-2002, 09:03 AM
I've already verified where it's bombing. Exactly at the delete line of a random npc... tends to be any god damn npc in the zone really.

DeletedUser
09-27-2002, 09:21 AM
is it possible its a corpse or theres something different?

DeletedUser
09-27-2002, 09:23 AM
Btw: Recently with 0.3.8 dev code, I have not seen this error occur, and it use to happen quite often for me :P

Wiz
09-27-2002, 09:54 AM
Not a corpse. An NPC.

Where is delete defined? Gonna see if updating said file works.