mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-24 00:00:44 +01:00
Fix some methods
This commit is contained in:
@@ -7,18 +7,17 @@ void TreeNode::release() {
|
||||
m_referenceCounter--;
|
||||
if (m_referenceCounter == 0) {
|
||||
if (numberOfChildren() != 0) {
|
||||
int lastIdentifier = lastDescendant()->identifier();
|
||||
int lastIdentifier = lastChild()->identifier();
|
||||
TreeNode * child = next();
|
||||
do {
|
||||
bool childWillBeDeleted = (child->m_referenceCounter == 1);
|
||||
bool lastChildReleased = false;
|
||||
while (!lastChildReleased) {
|
||||
lastChildReleased = child->identifier() == lastIdentifier;
|
||||
int nextSiblingIdentifier = lastChildReleased ? -1 : child->nextSibling()->identifier();
|
||||
child->release();
|
||||
if (!childWillBeDeleted) {
|
||||
printf("Incrementing iterator\n");
|
||||
child = child->next();
|
||||
} else {
|
||||
printf("Keeping iterator\n");
|
||||
if (nextSiblingIdentifier != -1) {
|
||||
child = TreePool::sharedPool()->node(nextSiblingIdentifier);
|
||||
}
|
||||
} while (child->identifier() != lastIdentifier);
|
||||
}
|
||||
}
|
||||
printf("Delete %d(%p)\n", m_identifier, this);
|
||||
int identifier = m_identifier;
|
||||
|
||||
Reference in New Issue
Block a user