Bug #183: PK Crash
ID | #183 |
---|---|
Submitter | Hollows |
Product | EOSERV |
Severity | Critical |
Status | CLOSED, FIXED |
Submitted | 19th Nov 2012 |
Updated | 1st Feb 2014 |
Rev# | Date | Description |
---|---|---|
r394 | 01 Feb 2014 22:34:40 UTC | UTIL_FOREACH does not reference by default, PK no longer crashes (bug #183), GCC 4.6+ is now ... |
Is it just me or does the server crash as soon as someone get's killed in PK (Normal combat, spells work fine).
Comments
Confirmed at elevated to critical.
Updated Severity to CRITICAL
Solved:
Character *character is never established. Change the appropriate lines in the boolean AttackPK to the following:
Character *character;
UTIL_FOREACH(this->characters, pkcharacter)
{
if (pkcharacter->mapid == this->id && !pkcharacter->nowhere && pkcharacter->x == target_x && pkcharacter->y == target_y)
{
character = pkcharacter;
Thanks apollo.
I've seen crashes on death before (I think they were related to dropping all your items, and happened when NPCs killed you as well), but nothing recently. No clue what the redundant code Apollo posted above is supposed to solve...
Could be more efficient probably. For some reason it crashes for every character pointer starting with GetHome and below in that death sequence. Might have worked simply by adding if(character && to that if statement. It isn't related to drop all items though, but adding that redundant code definitely fixes whatever the underlying problem is.
Its because the character is being removed from the map->characters container while it is being accessed.
Confirmed crash, but none of the speculating in this thread so far seems correct.
Updated Status to CONFIRMED
It does in fact appear to be caused by character being a Character*&, not just a Character*. The reference is presumably invalidated by the change to the container.
Apollo's fix will work, as it creates a copy of the pointer.
Fixed in r394.
Updated Status to CLOSED, FIXED
Add Comment
Please don't post unless you have something relevant to the bug to say.
Do not comment to say "thanks" or "fix this please".
Please log in to add comments. EOSERV Bug Tracker > Bug #183: PK Crash