<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40207 >

> [EMAIL PROTECTED] - Sat Apr 26 20:59:39 2008]:
> To fix this, it's not safe to just pass "tile" as it stands into the
> bowels of the effects system, since parts of that can access members
> of "tile" that haven't been initialised. However, I can't see any
> downside to making "tile" into a full copy of *ptile then passing
> that around, since nothing called from here should be modifying
> *ptile or any of its descendants.

By doing a full struct copy you alias pointers in the original
tile. This is generally a bad idea, though it looks like it
will not have any unfortunate consequences in this case so long
as all functions using the dummy tile respect its "constness"
(and do not modify its member pointers).

While you are modifying references to 'tile' I would change
the name to 'dummy' or 'dummy_tile' since 'struct tile tile'
is an eyesore and "dummy" would clearly mark its purpose
in the code.

> The attached patch implements this. (I had to bracket a macro
> argument in a header file as well.)

The missing brackets in the macro were a definite mistake.

> It fixes the bug, and hasn't obviously messed anything else up.

I can confirm that it compiles and fixes the bug.


Freeciv-dev mailing list

Reply via email to