Welcome to the Builder Academy

Question Game crashing

More
27 Apr 2023 00:51 #10323 by Nero
Replied by Nero on topic Game crashing
I added if (!ch) {
return;
}
at the top of the free_char function
that seemed to have stabilized it I am still running the game in GDB to see if it crashes again.

Please Log in or Create an account to join the conversation.

More
27 Apr 2023 19:25 #10325 by thomas
Replied by thomas on topic Game crashing
Thanks for getting back to us on this. Passing a NULL ch to free_char() should never happen. I'd check comm.c:2475, since this is where it's called from.

Please Log in or Create an account to join the conversation.

More
28 Apr 2023 00:15 #10327 by Nero
Replied by Nero on topic Game crashing
Yes I am still having the game crash and it still wants to point to this ch     if (ch->player_specials)
      free(ch->player_specials);

I recently tried redefining the IS_UNDEAD(CH) in utils.h to add a check for AFF_FLAG Undead. The idea was that it would let us equip items that provided an undead affect while still keeping the player's base race. I am not sure if this is the root cause because the game crashes on occasion like most games do but it seems to be way more frequent lately:
#define IS_UNDEAD(ch)             ((GET_RACE(ch) == RACE_UNDEAD) || AFF_FLAGGED(ch, AFF_UNDEAD) || (GET_RACE(ch) == RACE_VAMPIRE)|| (GET_RACE(ch) == RACE_SKELETON))

I went ahead and reverted it back to its original define for now and booted the game back up in gdb mode to keep an eye on it.

here is what I have for comm.c
Code:
void close_socket(struct descriptor_data *d) {   struct descriptor_data *temp;   REMOVE_FROM_LIST(d, descriptor_list, next);   if (0 != d->descriptor) {     CLOSE_SOCKET(d->descriptor);   }   flush_queues(d);   /* Forget snooping */   if (d->snooping)     d->snooping->snoop_by = NULL;   if (d->snoop_by) {     write_to_output(d->snoop_by, "Your victim is no longer among us.\r\n");     d->snoop_by->snooping = NULL;   }   if (d->character) {     /* If we're switched, this resets the mobile taken. */     d->character->desc = NULL;     /* Plug memory leak, from Eric Green. */     if (!IS_NPC(d->character) && PLR_FLAGGED(d->character, PLR_MAILING) && d->str) {       if (*(d->str))         free(*(d->str));       free(d->str);       d->str = NULL;     } else if (d->backstr && !IS_NPC(d->character) && !PLR_FLAGGED(d->character, PLR_WRITING)) {       free(d->backstr); /* editing description ... not olc */       d->backstr = NULL;     }     if (IS_PLAYING(d) || STATE(d) == CON_DISCONNECT) {       struct char_data *link_challenged = d->original ? d->original : d->character;       /* We are guaranteed to have a person. */       act("$n has lost $s link.", TRUE, link_challenged, 0, 0, TO_ROOM);       save_char(link_challenged);       mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(link_challenged)), TRUE, "Closing link to: %s.",              GET_NAME(link_challenged));     } else {       /* mudlog(CMP, LVL_IMMORT, TRUE, "Losing player: %s.", GET_NAME(d->character) ? GET_NAME(d->character) :        * "<null>"); */       free_char(d->character);     }   } else     mudlog(CMP, LVL_IMMORT, TRUE, "Losing descriptor without char.");   /* JE 2/22/95 -- part of my unending quest to make switch stable */   if (d->original && d->original->desc)     d->original->desc = NULL;   /* Clear the command history. */   if (d->history) {     for (int cnt = 0; cnt < HISTORY_SIZE; cnt++)       if (d->history[cnt])         free(d->history[cnt]);     free(d->history);   }   if (d->showstr_head)     free(d->showstr_head);   if (d->showstr_count)     free(d->showstr_vector);

Please Log in or Create an account to join the conversation.

More
28 Apr 2023 20:19 #10329 by thomas
Replied by thomas on topic Game crashing
Why have you commented out the "losing player: ..." log line? I think in this case it would be highly helpful.

Please Log in or Create an account to join the conversation.

More
10 May 2023 05:56 #10331 by Nero
Replied by Nero on topic Game crashing
I went ahead and put it back in but since correcting my issue with the #define IS_UNDEAD(ch) ((GET_RACE(ch) == RACE_UNDEAD) || AFF_FLAGGED(ch, AFF_UNDEAD) there have not been any issues.

Please Log in or Create an account to join the conversation.

Time to create page: 0.199 seconds