mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Fix a bug in SegmentStages.unlinkFromSegmentContextsChain() -- didn't account for exceptional exit from nested context
This commit is contained in:
@@ -350,7 +350,7 @@ public abstract class SegmentStages implements SegmentLock, LocksInterface {
|
||||
|
||||
public void checkNestedContextsQueryDifferentKeys(
|
||||
LocksInterface innermostContextOnThisSegment) {
|
||||
// TODO Spoon doesn't replace RHS instanceof occurances
|
||||
// TODO Spoon doesn't replace RHS instanceof occurrences
|
||||
if (innermostContextOnThisSegment.getClass() == this.getClass()) {
|
||||
Data key = ((KeySearch) innermostContextOnThisSegment).inputKey;
|
||||
if (Objects.equals(key, ((KeySearch) (Object) this).inputKey)) {
|
||||
@@ -364,10 +364,12 @@ public abstract class SegmentStages implements SegmentLock, LocksInterface {
|
||||
private void unlinkFromSegmentContextsChain() {
|
||||
LocksInterface prevContext = rootContextLockedOnThisSegment;
|
||||
while (true) {
|
||||
assert prevContext.nextNode() != null;
|
||||
if (prevContext.nextNode() == this)
|
||||
LocksInterface nextNode = prevContext.nextNode();
|
||||
// nextNode could be null, if this context failed initLocks() in
|
||||
// checkNestedContextsQueryDifferentKeys()
|
||||
if (nextNode == this || nextNode == null)
|
||||
break;
|
||||
prevContext = prevContext.nextNode();
|
||||
prevContext = nextNode;
|
||||
}
|
||||
// i. e. structured unlocking
|
||||
verifyInnermostContext();
|
||||
|
||||
Reference in New Issue
Block a user