CTGitPath CDirectoryWatcher::CloseInfoMap(HANDLE hDir) { AutoLocker lock(m_critSec); TInfoMap::const_iterator d = watchInfoMap.find(hDir); if (d != watchInfoMap.end()) { CTGitPath root = CTGitPath(CTGitPath(d->second->m_DirPath).GetRootPathString()); RemovePathAndChildren(root); BlockPath(root); } CloseWatchHandles(); CTGitPath path; if (watchInfoMap.empty()) return path; for (TInfoMap::iterator I = watchInfoMap.begin(); I != watchInfoMap.end(); ++I) { CDirectoryWatcher::CDirWatchInfo * info = I->second; ScheduleForDeletion (info); } watchInfoMap.clear(); return path; }
void CDirectoryWatcher::ClearInfoMap() { CloseWatchHandles(); if (!watchInfoMap.empty()) { AutoLocker lock(m_critSec); for (TInfoMap::iterator I = watchInfoMap.begin(); I != watchInfoMap.end(); ++I) { CDirectoryWatcher::CDirWatchInfo * info = I->second; I->second = NULL; ScheduleForDeletion (info); } watchInfoMap.clear(); } }
DynamicCellModelLoaderPtr DynamicModelLoaderRegistry::GetLoader(const std::string& rPath) { // Delete any waiting loaders ///\todo #1957 causes segfaults //mDeletableLoaders.clear(); DynamicCellModelLoaderPtr p_loader; // Have we opened this library already? std::map<std::string, DynamicCellModelLoaderWeakPtr>::iterator it = mLoaders.find(rPath); if (it == mLoaders.end() || it->second.expired()) { // Not loaded, or no longer used p_loader = DynamicCellModelLoader::Create(rPath); mLoaders[rPath] = p_loader; } else { p_loader = it->second.lock(); } ScheduleForDeletion(p_loader); ///\todo #1957 remove when unloading working return p_loader; }
bool CDirectoryWatcher::CloseHandlesForPath(const CTGitPath& path) { AutoLocker lock(m_critSec); CloseWatchHandles(); if (watchInfoMap.empty()) return false; for (TInfoMap::iterator I = watchInfoMap.begin(); I != watchInfoMap.end(); ++I) { CDirectoryWatcher::CDirWatchInfo * info = I->second; I->second = NULL; CTGitPath p = CTGitPath(info->m_DirPath); if (path.IsAncestorOf(p)) { RemovePathAndChildren(p); BlockPath(p); } ScheduleForDeletion(info); } watchInfoMap.clear(); return true; }