From 098ce84d7be0961f22ca5bc7e87c741f5e9a9d6b Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 8 Apr 2023 16:16:44 -0600 Subject: [PATCH] light: fix minor threading bug with `total_surflight_points` stat needs to be protected by mutex --- light/surflight.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/light/surflight.cc b/light/surflight.cc index 7a82d809..4d4f4fcf 100644 --- a/light/surflight.cc +++ b/light/surflight.cc @@ -79,7 +79,6 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys vector points; winding.dice(cfg.surflightsubdivision.value(), [&points, &facenormal](winding_t &w) { points.push_back(w.center() + facenormal); }); - total_surflight_points += points.size(); // Calculate emit color and intensity... @@ -141,6 +140,7 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys // Store light... unique_lock lck{surfacelights_lock}; + total_surflight_points += l.points.size(); surfacelights.push_back(l); const int index = static_cast(surfacelights.size()) - 1;