[Freeciv-Dev] Re: (PR#10389) logging of dead explorer
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10389 >
Per I. Mathisen wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=10389 >
>
> On Wed, 29 Sep 2004, Jason Short wrote:
>
>>but the unit is killed inside ai_manage_explorer so the second UNIT_LOG
>>results in some invalid memory accesses.
>
>
> But how could the unit die in the explorer code? This should not be
> possible. So we probably have two bugs here.
Barbarians in huts.
> Here is a patch for the first bug. It makes ai_manage_explorer() pass a
> pointer to a unit pointer, as suggested by Jason on irc.
But the pointer is never set to NULL in ai_manage_explorer, so it's
incomplete.
Using this solution (pointer-to-pointer) _might_ be a convenient and
efficient way to mark units as dead. But IMO if we use it it should be
done in many functions in the server. For instance we could pass the
handle value to server_remove_unit and set it to NULL in that function.
This would avoid most problems with accessing stale pointer values,
but is a bit ugly itself.
jason
|
|