From 7b8a64b6140c2fa63e755b6c9a195cae21cc7fb0 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 6 Jan 2014 08:28:40 +0000 Subject: [PATCH] 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). --- src/Scenery/tilemgr.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; -- 2.39.5