Notify earlier when removing a package node
Volume::_RemovePackageNode(): Notify listeners before removing the last package node from the node, . This prevents the size/last modified indices from not finding the node anymore, since the node would return a default value instead of the value it was added to the index with.
This commit is contained in:
@@ -1274,12 +1274,16 @@ Volume::_RemovePackageNode(Directory* directory, PackageNode* packageNode,
|
|||||||
// details.
|
// details.
|
||||||
|
|
||||||
PackageNode* headPackageNode = unpackingNode->GetPackageNode();
|
PackageNode* headPackageNode = unpackingNode->GetPackageNode();
|
||||||
unpackingNode->RemovePackageNode(packageNode);
|
|
||||||
|
|
||||||
// If the node doesn't have any more package nodes attached, remove it
|
|
||||||
// completely.
|
|
||||||
bool nodeRemoved = false;
|
bool nodeRemoved = false;
|
||||||
if (unpackingNode->GetPackageNode() == NULL) {
|
|
||||||
|
// If this is the last package node of the node, remove it completely.
|
||||||
|
if (unpackingNode->IsOnlyPackageNode(packageNode)) {
|
||||||
|
// Notify before removing the node. Otherwise the indices might not
|
||||||
|
// find the node anymore.
|
||||||
|
_NotifyNodeRemoved(node);
|
||||||
|
|
||||||
|
unpackingNode->RemovePackageNode(packageNode);
|
||||||
|
|
||||||
// we get and put the vnode to notify the VFS
|
// we get and put the vnode to notify the VFS
|
||||||
// TODO: We should probably only do that, if the node is known to the
|
// TODO: We should probably only do that, if the node is known to the
|
||||||
// VFS in the first place.
|
// VFS in the first place.
|
||||||
@@ -1293,13 +1297,14 @@ Volume::_RemovePackageNode(Directory* directory, PackageNode* packageNode,
|
|||||||
RemoveVNode(node->ID());
|
RemoveVNode(node->ID());
|
||||||
PutVNode(node->ID());
|
PutVNode(node->ID());
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
// The node does at least have one more package node.
|
||||||
|
unpackingNode->RemovePackageNode(packageNode);
|
||||||
|
|
||||||
if (nodeRemoved)
|
if (packageNode == headPackageNode) {
|
||||||
_NotifyNodeRemoved(node);
|
_NotifyNodeChanged(node, kAllStatFields,
|
||||||
else if (packageNode == headPackageNode) {
|
OldUnpackingNodeAttributes(headPackageNode));
|
||||||
_NotifyNodeChanged(node, kAllStatFields,
|
}
|
||||||
OldUnpackingNodeAttributes(headPackageNode));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!notify)
|
if (!notify)
|
||||||
|
|||||||
Reference in New Issue
Block a user