* Make sure child objects removed via removeChild() are not accessible
anymore from that collection. Fixes bug 551 <http://helma.org/bugs/show_bug.cgi?id=551>
This commit is contained in:
parent
ad68ca97b3
commit
9858091c20
3 changed files with 21 additions and 3 deletions
|
@ -793,7 +793,7 @@ public final class Node implements INode, Serializable {
|
||||||
pn2 = (Node) pn2.getNode(pinfo.collectionname);
|
pn2 = (Node) pn2.getNode(pinfo.collectionname);
|
||||||
} else if (pn2.equals(this)) {
|
} else if (pn2.equals(this)) {
|
||||||
// a special case we want to support: virtualname is actually
|
// a special case we want to support: virtualname is actually
|
||||||
// a reference to this node, not a collection containint this node.
|
// a reference to this node, not a collection containing this node.
|
||||||
setParent(pn);
|
setParent(pn);
|
||||||
name = pinfo.virtualname;
|
name = pinfo.virtualname;
|
||||||
anonymous = false;
|
anonymous = false;
|
||||||
|
@ -1376,9 +1376,15 @@ public final class Node implements INode, Serializable {
|
||||||
String propname = (localrel == null) ? prel.accessName : localrel.propName;
|
String propname = (localrel == null) ? prel.accessName : localrel.propName;
|
||||||
String prop = node.getString(propname);
|
String prop = node.getString(propname);
|
||||||
|
|
||||||
if ((prop != null) && (getNode(prop) == node)) {
|
if (prop != null) {
|
||||||
|
if (getNode(prop) == node) {
|
||||||
unset(prop);
|
unset(prop);
|
||||||
}
|
}
|
||||||
|
// let the node cache know this key's not for this node anymore.
|
||||||
|
if (state != TRANSIENT) {
|
||||||
|
nmgr.evictKey(new SyntheticKey(getKey(), prop));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO: We should unset constraints to actually remove subnodes here,
|
// TODO: We should unset constraints to actually remove subnodes here,
|
||||||
// but omit it by convention and to keep backwards compatible.
|
// but omit it by convention and to keep backwards compatible.
|
||||||
|
|
|
@ -407,6 +407,10 @@ public final class NodeManager {
|
||||||
*/
|
*/
|
||||||
public void evictKey(Key key) {
|
public void evictKey(Key key) {
|
||||||
cache.remove(key);
|
cache.remove(key);
|
||||||
|
// also drop key from thread-local transactor cache
|
||||||
|
if (Thread.currentThread() instanceof Transactor) {
|
||||||
|
((Transactor) Thread.currentThread()).dropCleanNode(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -139,6 +139,14 @@ public class Transactor extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drop a reference to an unmodified Node previously registered with visitCleanNode().
|
||||||
|
* @param key the key
|
||||||
|
*/
|
||||||
|
public void dropCleanNode(Key key) {
|
||||||
|
cleanNodes.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a reference to an unmodified Node local to this transaction
|
* Get a reference to an unmodified Node local to this transaction
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue