[Freeciv-Dev] Re: (PR#3700) Recall previous focus unit
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
|
|