Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: (PR#8521) sha.c crashes
Home

[Freeciv-Dev] Re: (PR#8521) sha.c crashes

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#8521) sha.c crashes
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 Apr 2004 12:07:23 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8521 >

Raimar Falke wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8521 >
> 
> On Thu, Apr 15, 2004 at 02:56:54PM -0700, Jason Short wrote:
> 
>><URL: http://rt.freeciv.org/Ticket/Display.html?id=8521 >
>>
>>When I play for any amount of time there's a segfault in sha.c. 
>>Something like this:
>>
>>#0  sha_unit_new (id=152) at sha.c:69
>>69      struct unit *pold_unit = 
>>create_unit_virtual(get_player(punit->owner),(gdb) bt
>>#0  sha_unit_new (id=152) at sha.c:69
>>#1  0x08120c57 in execute_call (call=0x82d93d0) at agents.c:213
>>#2  0x08120cee in call_handle_methods () at agents.c:251
>>#3  0x08120d77 in thaw () at agents.c:287
>>
>>Please fix.
> 
> 
> Of course the unit doesn't have to exists anymore when sha_unit_new is
> called.
> 
> I also added unit_clone and unit_destroy.

I don't think the logic of

   punit = create_unit_virtual(...);
   punit2 = unit_clone(punit);
   destroy_unit_virtual(punit);
   destroy_unit(punit2);

is good at all.  If punit2 is a virtual unit (which it obviously is) it 
should be destroyed by destroy_unit_virtual.

Which leads me to conclude that destroy_unit should be removed and 
unit_clone should be clone_unit_virtual.

A "virtual" unit is the part of the unit allocation that is common 
between client and server.  We don't need two concepts for this.

jason




[Prev in Thread] Current Thread [Next in Thread]