Clean and correct TreeNode

This commit is contained in:
Léa Saviot
2018-06-20 15:59:35 +02:00
parent 4c300e66d7
commit c6af4bb16c
2 changed files with 7 additions and 19 deletions

View File

@@ -2,20 +2,12 @@
#include "expression_node.h"
void TreeNode::release() {
printf("releasing of %d(%p)\n", m_identifier, this);
printf("Releasing of %d(%p)\n", m_identifier, this);
m_referenceCounter--;
if (m_referenceCounter == 0) {
#if 0
for (TreeNode * child : directChildren()) {
// BUG FIXME
// Here, if we end up delete-ing the node
// then the 'next child' is wrong...
child->release();
}
#endif
if (numberOfChildren() != 0) {
int lastIdentifier = lastDescendant()->identifier();
TreeNode * child = this;
TreeNode * child = next();
do {
bool childWillBeDeleted = (child->m_referenceCounter == 1);
child->release();