march: Fix concurrent updates at sector abandon prompt

When the player declines to abandon a sector, we write back stale land
units, triggering a generation oops.  Any updates made by other
threads meanwhile are wiped out, triggering a seqno mismatch oops.

The culprit is lnd_abandon_askyn(): when the player declines, it
returns without calling check_sect_ok(), check_land_ok().  Broken in
commit 7c1b166, v4.3.33.  Fix it.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-11-29 10:37:40 +01:00
parent 8daeffbd8f
commit 863fde5a2c
2 changed files with 3 additions and 7 deletions

View file

@ -963,21 +963,21 @@ int lnd_abandon_askyn(struct emp_qelem *list)
{ {
struct ulist *llp; struct ulist *llp;
struct sctstr sect; struct sctstr sect;
int abandon;
struct emp_qelem *qp; struct emp_qelem *qp;
if (QEMPTY(list)) if (QEMPTY(list))
return 1; return 1;
llp = (struct ulist *)list->q_back; llp = (struct ulist *)list->q_back;
getsect(llp->unit.land.lnd_x, llp->unit.land.lnd_y, &sect); getsect(llp->unit.land.lnd_x, llp->unit.land.lnd_y, &sect);
if (!abandon_askyn(&sect, I_CIVIL, 0, llp)) abandon = abandon_askyn(&sect, I_CIVIL, 0, llp);
return 0;
if (!check_sect_ok(&sect)) if (!check_sect_ok(&sect))
return 0; return 0;
for (qp = list->q_back; qp != list; qp = qp->q_back) { for (qp = list->q_back; qp != list; qp = qp->q_back) {
if (!check_land_ok(&((struct ulist *)qp)->unit.land)) if (!check_land_ok(&((struct ulist *)qp)->unit.land))
return 0; return 0;
} }
return 1; return abandon;
} }
int int

View file

@ -12,10 +12,6 @@ tester@127.0.0.1 logged out, country #1
Connect from 127.0.0.1 Connect from 127.0.0.1
tester@127.0.0.1 using country #1 tester@127.0.0.1 using country #1
tester@127.0.0.1 logged in as country #1 tester@127.0.0.1 logged in as country #1
Oops: elt->generation != (ef_generation & 0xfff) in ../src/lib/common/file.c:699
Crash dump complete
Oops: elt->generation != (ef_generation & 0xfff) in ../src/lib/common/file.c:699
Crash dump complete
tester@127.0.0.1 logged out, country #1 tester@127.0.0.1 logged out, country #1
Connect from 127.0.0.1 Connect from 127.0.0.1
tester@127.0.0.1 using country #0 tester@127.0.0.1 using country #0