if ( mob )
{
for ( prg = mob->pIndexData->mprogs; prg != NULL; prg = prg->next ) /* Line 2184 */
{
if ( prg->trig_type == type
&& strstr( argument, prg->trig_phrase ) != NULL )
{
program_flow( prg->vnum, prg->code, mob, NULL, NULL, ch, arg1, arg2 );
break;
}
}
}
Program received signal SIGSEGV, Segmentation fault.
0x000000000046615f in p_act_trigger (
argument=0x7fffffffd0f0 "The healer utters the word 'fido'.\n\r",
mob=0x7ffff7264bd0, obj=0x0, room=0x0, ch=0x7ffff737e038, arg1=0x0,
arg2=0x0, type=1) at mob_prog.c:2184
2184 for ( prg = mob->pIndexData->mprogs; prg != NULL; prg = prg->next )
for ( prg = mob->pIndexData->mprogs; prg != NULL; prg = prg->next ) /* Line 2184 */we know from the previous:
if( mob )that mob is not zero but the segment of code shown does not tell me (who to be honest is totally unfamiliar with the code) that mob->pIndexData points at anything and if it doesn't (or does not point to anything meaningful) then trying to dereference it to get the value pointed to in the mprogs member is going to crash and burn, a.k.a. Segmentation Fault (which I hope anyone working from the Dummy's Guide to 'C' programming will remember means: attempting to access a memory address outside of permitted range) - which is what seems to be happening isn't it?
for ( ; to ; to = to->next_in_room )
{
if (to->desc != NULL && to->desc->connected != CON_PLAYING) <<This line
continue; <<This line
if ( (!IS_NPC(to) && to->desc == NULL )
|| ( IS_NPC(to) && to->desc == NULL && !HAS_TRIGGER_MOB(to, TRIG_ACT) )
|| to->position < min_pos
|| ( type == TO_CHAR && to != ch )
|| ( type == TO_VICT && ( to != vch || to == ch ) )
|| ( type == TO_ROOM && to == ch )
|| ( type == TO_NOTVICT && ( to == ch || to == vch ) ) )
continue;
if ( (type == TO_ROOM || type == TO_NOTVICT)
&& !IS_NPC(ch) && !IS_NPC(to)
&& ch->in_room != NULL && to->in_room != NULL
&& IS_SET(ch->in_room->room_flags,ROOM_ARENA)
&& IS_SET(to->in_room->room_flags,ROOM_ARENA)
&& ch->pcdata->match != to->pcdata->match )
continue;
if ( mob )
{
for ( prg = mob->pIndexData->mprogs; prg != NULL; prg = prg->next ) /* Line 2184 */
{
if ( prg->trig_type == type
&& strstr( argument, prg->trig_phrase ) != NULL )
{
program_flow( prg->vnum, prg->code, mob, NULL, NULL, ch, arg1, arg2 );
break;
}
}
}
It happens randomly, and though it's while USING the note board system, when a player tries to write a note, as soon as they can start writing (I use the append_editor, but this problem has been happening since before that), boom, it crashes. I've used valgrind with all options minus the gdb (I stayed on to see what was going on with it). I don't know what keeps making the player do this. I do know it's Erwin's Board system which still uses the CON_NOTE states in nanny.c.
Here's the Valgrind on SegFault:
Now this only happens it seems when it's a player in which I've ploaded, then validated, then unloaded. Here's the punload code:
I also just realized this function has no return at the end, which I will fix.
Here's my validate command:
O.o This bug has been since I STARTED the QuickMUD and put the pload and punload function in. I don't know where the problem is. If it's my board.c file, then that is located on a redundant post here: http://www.mudbytes.net/topic-4672
I just want to get to the bottom of this. I'm wondering if it has something to do with the punload function's call to save and extract the character.