There are two kinds of compacting. One is where the game actually destroys some objects in order to make room -- that's when you see the "Compacting objects" message. The other is when the game just scans through the item list, and moves items around so that there are no more holes in the list. It's this latter kind of compacting that I've observed right before the bug.
Bug: Crash happening upon monster death
Collapse
X
-
-
I'm getting close. The problem seems to be with compacting objects and monster inventories. I don't have time to track it down completely right now, but it seems that after compact_objects(0) is called, then some monsters are left with references to dead objects. Maybe there's a fencepost error somewhere, so that everything in monster inventory except for one object is updated correctly?
I just managed to trigger this error (with a playtesting character) in GDB. So now I have a core dump and a debugger attached.
In my case, the problem is a mimic whose mimicked item has disappared (probably through compacting). Gabe, did you modify the compacting code to make sure mimicked items are not deleted? Normally if an item can be squelched the game assumes that it is free to delete them, but in the case of an item which is attached to a mimic, we shouldn't allow this to happen.
I will check this myself, but just wanted to ask in case you knew offhand.Comment
-
Gabe, thanks! I think you are definitely on the right track.
I just managed to trigger this error (with a playtesting character) in GDB. So now I have a core dump and a debugger attached.
In my case, the problem is a mimic whose mimicked item has disappared (probably through compacting). Gabe, did you modify the compacting code to make sure mimicked items are not deleted? Normally if an item can be squelched the game assumes that it is free to delete them, but in the case of an item which is attached to a mimic, we shouldn't allow this to happen.
I will check this myself, but just wanted to ask in case you knew offhand.
I've been trying to debug by summoning lots of cutpurses and watching the item compacting behavior. It seems that sometimes, randomly, a monster thinks its holding nothing, even very soon after it picks something up. I'm still trying to track down why, however.Comment
-
In my case, the problem is a mimic whose mimicked item has disappared (probably through compacting). Gabe, did you modify the compacting code to make sure mimicked items are not deleted? Normally if an item can be squelched the game assumes that it is free to delete them, but in the case of an item which is attached to a mimic, we shouldn't allow this to happen.Comment
-
Edit: As an added sanity check, I reverted to before the mimic stuff was committed, and was able to get a crash in the same way. Which is sad, because the bug is still at large, but relieving, because it's not entirely my faultLast edited by CunningGabe; July 3, 2011, 00:53.Comment
-
I think what is happening somehow is that an object thinks it is held by a monster other than the one it is held by. (That is, o_ptr->held_m_idx is incorrect.) Then, when the object is moved in the object list, the monster that is actually holding it doesn't get the update, and so the index it has ends up referring to a possibly empty object.
I checked the monster compacting to make sure that it updates o_ptr->held_m_idx appropriately, and it seems that it does. Still trying to look for the problem...
Edit: Found it! Monsters know their own monster index, but the monster compacting code wasn't updating that index. I'll put up a fix now.Last edited by CunningGabe; July 3, 2011, 21:10.Comment
Comment