Mercurial > hg > orthanc-webviewer
diff Plugin/Cache/CacheManager.cpp @ 147:70d1fe6d6309
Avoid hard crash if not enough memory
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 09 Nov 2016 12:43:58 +0100 |
parents | 3809121c3290 |
children | 1a90184363f8 |
line wrap: on
line diff
--- a/Plugin/Cache/CacheManager.cpp Wed Nov 09 12:20:01 2016 +0100 +++ b/Plugin/Cache/CacheManager.cpp Wed Nov 09 12:43:58 2016 +0100 @@ -126,6 +126,7 @@ struct CacheManager::PImpl { + OrthancPluginContext* context_; Orthanc::SQLite::Connection& db_; Orthanc::FilesystemStorage& storage_; @@ -134,8 +135,10 @@ BundleQuota defaultQuota_; BundleQuotas quotas_; - PImpl(Orthanc::SQLite::Connection& db, + PImpl(OrthancPluginContext* context, + Orthanc::SQLite::Connection& db, Orthanc::FilesystemStorage& storage) : + context_(context), db_(db), storage_(storage), sanityCheck_(false) @@ -278,15 +281,22 @@ - CacheManager::CacheManager(Orthanc::SQLite::Connection& db, + CacheManager::CacheManager(OrthancPluginContext* context, + Orthanc::SQLite::Connection& db, Orthanc::FilesystemStorage& storage) : - pimpl_(new PImpl(db, storage)) + pimpl_(new PImpl(context, db, storage)) { Open(); ReadBundleStatistics(); } + OrthancPluginContext* CacheManager::GetPluginContext() const + { + return pimpl_->context_; + } + + void CacheManager::SetSanityCheckEnabled(bool enabled) { pimpl_->sanityCheck_ = enabled;