From: James Turner Date: Mon, 6 Jan 2014 08:28:40 +0000 (+0000) Subject: Crash fix: thread-safe material conditions X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7b8a64b6140c2fa63e755b6c9a195cae21cc7fb0;p=flightgear.git Crash fix: thread-safe material conditions When tiles are being loaded, re-evaluate the materials cache once per update cycle. (This is probably too often, but no worse than the previous approach). --- diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx index 8216c0a86..3df77c0e5 100644 --- a/src/Scenery/tilemgr.cxx +++ b/src/Scenery/tilemgr.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include
#include
@@ -251,7 +252,8 @@ void FGTileMgr::update_queues(bool& isDownloadingScenery) TileEntry *e; int loading=0; int sz=0; - + bool didRefreshMaterialCache = false; + tile_cache.set_current_time( current_time ); tile_cache.reset_traversal(); @@ -266,6 +268,11 @@ void FGTileMgr::update_queues(bool& isDownloadingScenery) e->prep_ssg_node(vis); if (!e->is_loaded()) { + if (!didRefreshMaterialCache) { + didRefreshMaterialCache = true; + globals->get_matlib()->refreshActiveMaterials(); + } + bool nonExpiredOrCurrent = !e->is_expired(current_time) || e->is_current_view(); bool downloading = isTileDirSyncing(e->tileFileName); isDownloadingScenery |= downloading;