Volume: Remove all package contents on destruction

This commit is contained in:
Ingo Weinhold 2011-06-24 13:31:21 +02:00
parent 77574d40ee
commit 59acdf5045
2 changed files with 20 additions and 2 deletions

View File

@ -438,8 +438,8 @@ Volume::~Volume()
{
_TerminatePackageLoader();
while (PackageDomain* packageDomain = fPackageDomains.RemoveHead())
packageDomain->ReleaseReference();
while (PackageDomain* packageDomain = fPackageDomains.Head())
_RemovePackageDomain(packageDomain);
// remove all nodes from the ID hash table
Node* node = fNodes.Clear(true);
@ -638,6 +638,23 @@ Volume::AddPackageDomain(const char* path)
}
void
Volume::_RemovePackageDomain(PackageDomain* domain)
{
// remove the domain's packages from the node tree
VolumeWriteLocker systemVolumeLocker(_SystemVolumeIfNotSelf());
VolumeWriteLocker volumeLocker(this);
for (PackageFileNameHashTable::Iterator it
= domain->Packages().GetIterator(); Package* package = it.Next();) {
_RemovePackageContent(package, NULL, false);
}
// remove the domain
fPackageDomains.Remove(domain);
domain->ReleaseReference();
}
void
Volume::PackageLinkDirectoryAdded(PackageLinkDirectory* directory)
{

View File

@ -107,6 +107,7 @@ private:
status_t _AddInitialPackageDomain(const char* path);
status_t _AddPackageDomain(PackageDomain* domain,
bool notify);
void _RemovePackageDomain(PackageDomain* domain);
status_t _LoadPackage(Package* package);
status_t _AddPackageContent(Package* package,