forked from mirror/openmw-tes3mp
Fix cleanup issue
This commit is contained in:
parent
fd215caa02
commit
97ed999097
2 changed files with 12 additions and 3 deletions
|
@ -210,9 +210,14 @@ namespace MWWorld
|
||||||
mTerrainPreloadItem->waitTillDone();
|
mTerrainPreloadItem->waitTillDone();
|
||||||
mTerrainPreloadItem = NULL;
|
mTerrainPreloadItem = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mTerrainView = NULL;
|
mTerrainView = NULL;
|
||||||
|
|
||||||
|
if (mUpdateCacheItem)
|
||||||
|
{
|
||||||
|
mUpdateCacheItem->waitTillDone();
|
||||||
|
mUpdateCacheItem = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (PreloadMap::iterator it = mPreloadCells.begin(); it != mPreloadCells.end();++it)
|
for (PreloadMap::iterator it = mPreloadCells.begin(); it != mPreloadCells.end();++it)
|
||||||
it->second.mWorkItem->abort();
|
it->second.mWorkItem->abort();
|
||||||
|
|
||||||
|
@ -320,10 +325,11 @@ namespace MWWorld
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timestamp - mLastResourceCacheUpdate > 1.0)
|
if (timestamp - mLastResourceCacheUpdate > 1.0 && (!mUpdateCacheItem || mUpdateCacheItem->isDone()))
|
||||||
{
|
{
|
||||||
// the resource cache is cleared from the worker thread so that we're not holding up the main thread with delete operations
|
// the resource cache is cleared from the worker thread so that we're not holding up the main thread with delete operations
|
||||||
mWorkQueue->addWorkItem(new UpdateCacheItem(mResourceSystem, timestamp), true);
|
mUpdateCacheItem = new UpdateCacheItem(mResourceSystem, timestamp);
|
||||||
|
mWorkQueue->addWorkItem(mUpdateCacheItem, true);
|
||||||
mLastResourceCacheUpdate = timestamp;
|
mLastResourceCacheUpdate = timestamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,6 +403,8 @@ namespace MWWorld
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// TODO: provide some way of giving the preloaded view to the main thread when we enter the cell
|
||||||
|
// right now, we just use it to make sure the resources are preloaded
|
||||||
mTerrainPreloadPositions = positions;
|
mTerrainPreloadPositions = positions;
|
||||||
mTerrainPreloadItem = new TerrainPreloadItem(mTerrainView, mTerrain, positions);
|
mTerrainPreloadItem = new TerrainPreloadItem(mTerrainView, mTerrain, positions);
|
||||||
mWorkQueue->addWorkItem(mTerrainPreloadItem);
|
mWorkQueue->addWorkItem(mTerrainPreloadItem);
|
||||||
|
|
|
@ -106,6 +106,7 @@ namespace MWWorld
|
||||||
osg::ref_ptr<Terrain::View> mTerrainView;
|
osg::ref_ptr<Terrain::View> mTerrainView;
|
||||||
std::vector<osg::Vec3f> mTerrainPreloadPositions;
|
std::vector<osg::Vec3f> mTerrainPreloadPositions;
|
||||||
osg::ref_ptr<SceneUtil::WorkItem> mTerrainPreloadItem;
|
osg::ref_ptr<SceneUtil::WorkItem> mTerrainPreloadItem;
|
||||||
|
osg::ref_ptr<SceneUtil::WorkItem> mUpdateCacheItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue