PackageLinkDirectory::_Update(): Don't unlock after delete

When using an AutoLocker on an object, the lock must be released
explicitly before releasing the last certain reference to that object.
This commit is contained in:
Ingo Weinhold 2011-11-05 17:20:45 +01:00
parent b8ae1eb25d
commit 34afc17190

View File

@ -175,11 +175,12 @@ PackageLinkDirectory::_Update(PackageLinksListener* listener)
// Always remove all dependency links -- if there's still a package, they
// will be re-created below.
while (DependencyLink* link = fDependencyLinks.RemoveHead()) {
NodeWriteLocker selfLinkLocker(link);
NodeWriteLocker linkLocker(link);
if (listener != NULL)
listener->PackageLinkNodeRemoved(link);
RemoveChild(link);
linkLocker.Unlock();
link->ReleaseReference();
}
@ -193,6 +194,7 @@ PackageLinkDirectory::_Update(PackageLinksListener* listener)
listener->PackageLinkNodeRemoved(fSelfLink);
RemoveChild(fSelfLink);
selfLinkLocker.Unlock();
fSelfLink->ReleaseReference();
fSelfLink = NULL;
}