Re: iedit and oasis

From: Dana Luther (dtluther@mindspring.com)
Date: 05/27/00


>Damian wrote:
>> I tried out the oasis and circle bpl 17 package recommended, but it still
>didnt
>> work. exactly the same error as in all the other attempts made. backtrace
>> tracks it down to copy_object(). and no, I am still not using windows.


 (Josh replied)


>I have this same crash bug myself.  Yes, the crash goes through
>copy_object() but more specifically free_object_strings() at which it
>crashes the first time it tries to free something:
>
>void free_object_strings(struct obj_data *obj)
>{
><snip, debugging code>
>
>  if (obj->name)
>    free(obj->name);  <--*crash, line 385*
>  if (obj->description)
>    free(obj->description);
>  if (obj->short_description)


I actually have something that is quite different from this. There was a
conflict with copy_object already being used, so I kept the old one and
added the new one that came with the iedit patch, but made it  copy_iobject
instead. (The function is shown here exactly as it is in the patch, the only
thing I changed was the name.)
In this function, the strings are taken care of like this:

/* make a complete copy of an object */
struct obj_data *copy_iobject(struct obj_data *obj) {
  struct extra_descr_data *this, *temp, *temp2;
  struct obj_affected_type *affs;
  struct obj_data *returno;
  int i;

  /* allocate object */
  CREATE(returno, struct obj_data, 1);

  clear_object(returno);

  /* create the interal seperate structs */


  /* copy all strings over */
  if (obj->name)
    returno->name = str_dup(obj->name);

  if (obj->short_description)
    returno->short_description = str_dup(obj->short_description);

  if (obj->description)
    returno->description = str_dup(obj->description);


etc.
   This seems to work well as I've not had it do any weird things on me.
*knock on wood*, and the copy_iobject function never calls the
free_object_strings function.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT