[freeciv-ai] Re: (PR#6236) uninitialized citymap value
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Raimar Falke wrote:
>>Per I. Mathisen wrote:
>>
>>>On Sun, 21 Sep 2003, Jason Short wrote:
>>>
>>>
>>>>>Valgrind gives this fairly often for the server:
>>>>>==13287== at 0x8067A58: auto_arrange_workers (cityturn.c:235)
>>>
>>>...
>>>
>>>
>>>>>Could relate to PR#6222, but I doubt it (this is just an invalid read).
>>>>>This may have been reported before. We really need to fix it.
>>>>
>>>>The culprit is the worker_positions_used field. In the client this is
>>>>memset to 0 before it is used. In the server it's not.
>>>
>>>
>>>I don't see why it should be. cm_query_result() shouldn't give us a
>>>cm_result struct with unset data in it. So the bug must be in CM.
>>>
>>>I looked at this briefly but found nothing. Raimar?
>>
>>my_city_map_iterate skips the center tile.
>
>
>>- my_city_map_iterate(pcity, x, y) {
>>+ city_map_checked_iterate(pcity->x, pcity->y, x, y, mx, my) {
>> result->worker_positions_used[x][y] =
>> (base_combination->worker_positions[x][y] == C_TILE_WORKER);
>>- } my_city_map_iterate_end;
>>+ } city_map_checked_iterate_end;
>
>
> Sorry but this patch is plain wrong. worker_positions is never set for
> the center tile. You did have luck that the warning vanished and no
> new warning surfaced. I will revert the patch.
Can you provide another patch to fix the problem, then?
jason
|
|