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_lightingThread.finish();
clearWorld();
}
@ -1446,11 +1447,10 @@ void WorldClient::lightingTileGather() {
void WorldClient::lightingMain() {
while (true) {
MutexLocker locker(m_lightingMutex);
if (m_stopLightingThread)
return;
MutexLocker locker(m_lightingMutex);
if (m_renderData) {
int64_t start = Time::monotonicMilliseconds();

View File

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