From d99a24843b4fbb9ab7f1b5b493d04e7350d2d5af Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 9 Dec 2024 21:41:26 -0500 Subject: [PATCH] deal with light sources in discard_migrations() Otherwise, when discard_migrations() purges monsters, their stale monster pointers can be left inside the light source data structure. --- src/dog.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dog.c b/src/dog.c index 607f2cdf8..c4e4b60e7 100644 --- a/src/dog.c +++ b/src/dog.c @@ -914,6 +914,8 @@ discard_migrations(void) mtmp->nmon = 0; discard_minvent(mtmp, FALSE); /* bypass mongone() and its call to m_detach() plus dmonsfree() */ + if (emits_light(mtmp->data)) + del_light_source(LS_MONSTER, monst_to_any(mtmp)); dealloc_monst(mtmp); } }