1
0
Fork 0

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).
This commit is contained in:
James Turner 2014-01-06 08:28:40 +00:00
parent 448539a6b9
commit 7b8a64b614

View file

@ -38,6 +38,7 @@
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
#include <simgear/scene/tsync/terrasync.hxx>
#include <simgear/misc/strutils.hxx>
#include <simgear/scene/material/matlib.hxx>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
@ -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;