From 60083e88649d58d6c85caaaeffa3386ae1b908fd Mon Sep 17 00:00:00 2001 From: Marko Semet Date: Sat, 22 Jun 2019 17:20:09 +0200 Subject: [PATCH] Found bug by recursion --- include/sirEdit/data/tools.hpp | 2 +- meson.build | 5 ++++- src/unittests/rules/model.hpp | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/sirEdit/data/tools.hpp b/include/sirEdit/data/tools.hpp index a2fa420..6bc001f 100644 --- a/include/sirEdit/data/tools.hpp +++ b/include/sirEdit/data/tools.hpp @@ -158,7 +158,7 @@ namespace sirEdit::data { TYPE_STATE getTypeTransitiveState(const Type& type) const { // Is at least read? if(!this->__hasReadSubtype(type)) - return TYPE_STATE::NO; + return TYPE_STATE::UNUSED; // Get current state TYPE_STATE result = TYPE_STATE::READ; diff --git a/meson.build b/meson.build index 420818e..e824859 100644 --- a/meson.build +++ b/meson.build @@ -63,7 +63,10 @@ src_siredit_test = [ 'src/unittests/rules/rule1.cpp', 'src/unittests/rules/rule2.cpp', 'src/unittests/rules/rule3.cpp', - 'src/unittests/rules/rule4.cpp' + 'src/unittests/rules/rule4.cpp', + 'src/unittests/rules/rule5.cpp', + 'src/unittests/rules/rule6.cpp', + 'src/unittests/rules/rule7.cpp' ] # Resource encoding diff --git a/src/unittests/rules/model.hpp b/src/unittests/rules/model.hpp index 6da8283..a459060 100644 --- a/src/unittests/rules/model.hpp +++ b/src/unittests/rules/model.hpp @@ -40,7 +40,8 @@ namespace { Type* super = const_cast(getSuper(*(i.second))); // Add to subtypes list - super->getSubTypes().push_back(i.second); + if(super != nullptr) + super->getSubTypes().push_back(i.second); } // TODO: Type inconsistent @@ -86,6 +87,8 @@ namespace { this->_addType(this->g); this->_addType(this->h); this->_addType(this->i); + + this->_update(); } }; }