Skip to content

Commit

Permalink
Fix null cache crashes. (#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
acolwell authored Nov 24, 2024
1 parent 21d6f2a commit de45046
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Engine/AppManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,15 @@ AppManager::~AppManager()
QThreadPool::globalInstance()->waitForDone();

///Kill caches now because decreaseNCacheFilesOpened can be called
_imp->_nodeCache->waitForDeleterThread();
_imp->_diskCache->waitForDeleterThread();
_imp->_viewerCache->waitForDeleterThread();
if (_imp->_nodeCache) {
_imp->_nodeCache->waitForDeleterThread();
}
if (_imp->_diskCache) {
_imp->_diskCache->waitForDeleterThread();
}
if (_imp->_viewerCache) {
_imp->_viewerCache->waitForDeleterThread();
}
_imp->_nodeCache.reset();
_imp->_viewerCache.reset();
_imp->_diskCache.reset();
Expand Down
4 changes: 4 additions & 0 deletions Engine/AppManagerPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ template <typename T>
void
saveCache(Cache<T>* cache)
{
if (!cache) {
return;
}

std::string cacheRestoreFilePath = cache->getRestoreFilePath();
FStreamsSupport::ofstream ofile;
FStreamsSupport::open(&ofile, cacheRestoreFilePath);
Expand Down

0 comments on commit de45046

Please sign in to comment.