diff --git a/utils/LocHeap.cpp b/utils/LocHeap.cpp index 41268789..d667f14f 100644 --- a/utils/LocHeap.cpp +++ b/utils/LocHeap.cpp @@ -199,7 +199,7 @@ bool LocHeapNode::checkNodes() { int totalSize = mSize; if (mLeft) { // check the consistency of left subtree - if (!outRanks(*mLeft) || !mLeft->checkNodes()) { + if (mLeft->outRanks(*this) || !mLeft->checkNodes()) { return false; } // subtract the size of left subtree (with subtree head) @@ -208,7 +208,7 @@ bool LocHeapNode::checkNodes() { if (mRight) { // check the consistency of right subtree - if (!outRanks(*mRight) || !mRight->checkNodes()) { + if (mRight->outRanks(*this) || !mRight->checkNodes()) { return false; } // subtract the size of right subtree (with subtree head) diff --git a/utils/LocTimer.cpp b/utils/LocTimer.cpp index 53ca700d..0f698c54 100644 --- a/utils/LocTimer.cpp +++ b/utils/LocTimer.cpp @@ -349,8 +349,12 @@ void LocTimerContainer::remove(LocTimerDelegate& timer) { LocMsg(), mTimerContainer(&container), mTimer(&timer) {} inline virtual void proc() const { LocTimerDelegate* priorTop = mTimerContainer->getSoonestTimer(); - if (NULL != ((LocHeap*)mTimerContainer)->remove((LocRankable&)*mTimer)) { - mTimerContainer->updateSoonestTime(priorTop); + // update soonest timer only if mTimer is actually removed from mTimerContainer + // AND mTimer is not priorTop. + if (priorTop == ((LocHeap*)mTimerContainer)->remove((LocRankable&)*mTimer)) { + // if passing in NULL, we tell updateSoonestTime to update kernel with + // the current top timer interval. + mTimerContainer->updateSoonestTime(NULL); } delete mTimer; }