Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] Re: (PR#3700) Recall previous focus unit
Home

[Freeciv-Dev] Re: (PR#3700) Recall previous focus unit

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: a-l@xxxxxxx
Subject: [Freeciv-Dev] Re: (PR#3700) Recall previous focus unit
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 12 Apr 2003 12:21:55 -0700
Reply-to: rt@xxxxxxxxxxxxxx

a-l@xxxxxxx wrote:
> On Fri, 21 Mar 2003 17:01:44 -0800
> "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> wrote:

>>- Is it possible for the previous_focus_id unit to die, and its ID to be
>>taken by a different unit?  This would give buggy, but rather unharmful,
>>results.  Is there an easy way to prevent this?
> 
> 
> Ok, I changed it to use a unit struct pointer instead, checking for
> NULL.

I'm pretty sure that's unsafe.  If the unit is destroyed or reallocated 
you'll end up with a non-NULL pointer pointing to an arbitrary piece of 
memory.  The original bug, if it exists at all, can only be solved by 
something much more complex (and probably not worthwhile).

jason




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