Fix rare world lighting thread race

This commit is contained in:
Kae 2023-06-30 06:35:46 +10:00
parent cb1390e9f3
commit 7d847fcd6a
2 changed files with 3 additions and 3 deletions

View File

@ -92,6 +92,7 @@ WorldClient::~WorldClient() {
m_lightingCond.broadcast(); m_lightingCond.broadcast();
} }
m_lightingThread.finish();
clearWorld(); clearWorld();
} }
@ -1446,11 +1447,10 @@ void WorldClient::lightingTileGather() {
void WorldClient::lightingMain() { void WorldClient::lightingMain() {
while (true) { while (true) {
MutexLocker locker(m_lightingMutex);
if (m_stopLightingThread) if (m_stopLightingThread)
return; return;
MutexLocker locker(m_lightingMutex);
if (m_renderData) { if (m_renderData) {
int64_t start = Time::monotonicMilliseconds(); int64_t start = Time::monotonicMilliseconds();

View File

@ -252,7 +252,7 @@ private:
mutable Mutex m_lightingMutex; mutable Mutex m_lightingMutex;
mutable ConditionVariable m_lightingCond; mutable ConditionVariable m_lightingCond;
mutable WorldRenderData* m_renderData; mutable WorldRenderData* m_renderData;
bool m_stopLightingThread; atomic<bool> m_stopLightingThread;
SkyPtr m_sky; SkyPtr m_sky;