----------
From: John Evans[SMTP:evansj@HI-LINE.NET]
I am having a problem with a crash-bug here. It happens when an object is
extracted via the 'R' zone command for removing an object. I can purge
and junk objects just fine, but as soon as the game tries to remove one,
it crashes... Here is the gdb and code.
GDB OUTPUT:
(gdb) p temp->next
Cannot access memory at address 0x290813d8.
(gdb) p temp
$1 = (struct obj_data *) 0x29081338
(gdb) p temp->name
Cannot access memory at address 0x290813ac.
(gdb) quit
Notice that temp->next is unaccessable for some reason. Look at the code
and tell me if you can spot why...
/* BEGIN REMOVE_FROM_LIST */
if (obj == object_list)
object_list = obj->next;
else {
temp = object_list;
while (temp && (temp->next != obj))
temp = temp->next;
if (temp)
temp->next = obj->next;
}
/* END REMOVE_FROM_LIST */
> Well, the best I can offer is that you do not test for
> the null condition of temp->next. Thus you are probably
> seg faulting here. Try:
> while (temp && temp->next && (temp->next != obj))
>
> Not sure this is it, but its a good idea to always check
> for the NULL condition anyway.
>
> --Sean
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST