Thanks. If you have the environment ready for reproducing this, before I get to setting up such environment myself, could you check what values punit->activity and punit->activity_target have on that final backtrace frame.
E.g., on the same gdb prompt where you get the backtrace:
# print punit->activity;
# print punit->activity_target;
# print unit_rule_name(punit);
Sure:
(gdb) print punit->activity $1 = ACTIVITY_IRRIGATE (gdb) print punit->activity_target $2 = (struct extra_type *) 0x0 (gdb) print unit_rule_name(punit) $3 = 0x555555c44ed0 <unit_types+2960> "Workers"
Let me now if you need anything else.
Even without figuring exact details of this case, I think we have a general problem in that a change on "tile + units doing activities on it" is not atomic, and which ever order we send those packets there's always a chance that activity of some unit is not compatible with the terrain on tile (or some other tile property).
However, as this is only temporary situation (the other packets are enroute already), I guess we can just skip handling of that illegal state and wait that later packet turns it legal and refreshes the UI.
Seems to me that S2_6 would be affected, but as I have no reason to believe that this is a regression since 2.6.8, I'd rather not postpone 2.6.9 release to fix this.
I hope attached patch fix this.
It's also possible that it just postpones the crash by some code lines.
Reply To cazfi
I hope attached patch fix this. It's also possible that it just postpones the crash by some code lines.
It seems to work. My savegame no longer crashes with this patch applied (S3_0). I continued the game 10 more turns without further crashes.
I was playing my custom ruleset with freeciv 3.0.7 + patch #47856. It crashes every time I end the turn with qt client, but I can continue the game with gtk.
The backtrace: