| 32 | } |
| 33 | |
| 34 | void StandaloneView::removeFromParent() { |
| 35 | auto parent = getParent(); |
| 36 | if (parent != nullptr) { |
| 37 | _parent.reset(); |
| 38 | |
| 39 | auto it = parent->_children.begin(); |
| 40 | while (it != parent->_children.end()) { |
| 41 | if (it->get() == this) { |
| 42 | parent->_children.erase(it); |
| 43 | return; |
| 44 | } |
| 45 | ++it; |
| 46 | } |
| 47 | |
| 48 | SC_ASSERT_FAIL("Could not resolve self in parent"); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | void StandaloneView::addChild(const Ref<StandaloneView>& child) { |
| 53 | addChild(child, _children.size()); |
no test coverage detected