|
![]() |
#1 |
Adept
Join Date: Mar 2016
Posts: 194
![]() |
Crash due to referencing object deleted by drop_near()
Rather than clutter the Vanilla board, I'll discuss my findings here. Original thread is here
In summary, there is a repeatable crash if a monster picks up an object and that object is destroyed when the monster dies due to lack of floor space. The 'birth_stacking' flag seems to be ignored (the save file in the referenced thread has stacking on'. In obj-pile.c in drop_near() there are a couple of chunks of code like this: Code:
/* Message */ msg("The %s %s.", o_name, VERB_AGREEMENT(dropped->number, "disappears", "disappear")); /* Debug */ if (player->wizard) msg("Breakage (no floor space)."); /* Failure */ if (dropped->known) { delist_object(cave_k, dropped->known); object_delete(&dropped->known); } delist_object(c, dropped); object_delete(&dropped); return; Code:
/* Don't delist an actual object if it still has a listed known object */ if ((c == cave) && cave_k->objects[obj->oidx]) return; c->objects[obj->oidx] = NULL; obj->oidx = 0; In mon_move.c in process_monster_grab_objects(), the code which performs the pick-up is Code:
square_excise_object(c, ny, nx, obj); monster_carry(c, mon, obj); square_note_spot(c, ny, nx); square_light_spot(c, ny, nx); Hopefully this helps track down this nasty |
![]() |
![]() |
![]() |
#2 | |
Vanilla maintainer
Join Date: Apr 2007
Location: Canberra, Australia
Age: 57
Posts: 9,480
Donated: $60
![]() ![]() |
Quote:
So what actually happened was this:
Bug is fixed in development ![]()
__________________
One for the Dark Lord on his dark throne In the Land of Mordor where the Shadows lie. |
|
![]() |
![]() |
![]() |
#3 |
Prophet
Join Date: Apr 2008
Posts: 2,955
![]() |
No idea if it's related to this bug at all, since this happened in PWMAngband and not in Vanilla Angband, but the code is roughly the same. I was clearing a mixed n/M pit when the game crashed in drop_near() during monster death:
Code:
/* Drop objects being carried */ obj = mon->held_obj; while (obj) { next = obj->next; /* Object no longer held */ obj->held_m_idx = 0; pile_excise(&mon->held_obj, obj); ... drop_near(p, c, obj, 0, mon->fy, mon->fx, true, DROP_FADE); obj = next; } /* Forget objects */ mon->held_obj = NULL;
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant! |
![]() |
![]() |
![]() |
#4 | |
Vanilla maintainer
Join Date: Apr 2007
Location: Canberra, Australia
Age: 57
Posts: 9,480
Donated: $60
![]() ![]() |
Quote:
Code:
if (dropped->known) { delist_object(cave_k, dropped->known); object_delete(&dropped->known); } Code:
if (dropped->known) { if (dropped->known->iy && dropped->known->ix) square_excise_object(cave_k, dropped->known->iy, dropped->known->ix, dropped->known); delist_object(cave_k, dropped->known); object_delete(&dropped->known); }
__________________
One for the Dark Lord on his dark throne In the Land of Mordor where the Shadows lie. |
|
![]() |
![]() |
![]() |
#5 |
Prophet
Join Date: Apr 2008
Posts: 2,955
![]() |
It's not the case (especially since I didn't implement object lists like in V). I think I found the problem (except from drop_near):
Code:
/* Give it to the floor */ if (!floor_carry(c, by, bx, dropped, false)) ... /* Sound */ sound(MSG_DROP); /* Message when an object falls under the player */ if (verbose && (c->squares[by][bx].mon < 0)) /* Check the item still exists and isn't ignored */ if (c->objects[dropped->oidx] && !ignore_item_ok(dropped)) msg("You feel something roll beneath your feet."); Code:
/* Scan objects in that grid for combination */ for (obj = square_object(c, y, x); obj; obj = obj->next) { /* Check for combination */ if (object_similar(obj, drop, OSTACK_FLOOR)) { /* Combine the items */ object_absorb(obj, drop); /* Result */ return true; } /* Count objects */ n++; } Code:
/* Add together the item counts */ obj1->number = (total < z_info->stack_size ? total : z_info->stack_size); object_absorb_merge(obj1, obj2); object_delete(&obj2);
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant! |
![]() |
![]() |
![]() |
#6 |
Prophet
Join Date: Apr 2008
Posts: 2,955
![]() |
FYI: commit ec27572 introduced the bug.
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant! |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
borg out of sync sometimes due to lag in update on p_ptr->inventory[] | APWhite | Development | 1 | September 10, 2011 21:39 |
Ridiculous death due, in my opinion, to flawed design. | Vogrim | Vanilla | 168 | January 4, 2011 22:46 |
Amazing character but still YASD due to NAsTY monster | Thraalbee | AAR | 12 | September 11, 2010 09:13 |
object list | fyonn | Vanilla | 17 | June 23, 2010 16:04 |
28 tickets due by May 31. | PaulBlay | Development | 0 | May 5, 2009 21:26 |