diff --git a/lib/SDL b/lib/SDL index 87a83787..9f8425a7 160000 --- a/lib/SDL +++ b/lib/SDL @@ -1 +1 @@ -Subproject commit 87a83787a3a0a9922b02b35ba809d9da86930fc8 +Subproject commit 9f8425a7a9e7c6c64759cf4c7b7489b230d442c4 diff --git a/lib/openal-soft b/lib/openal-soft index d66107e9..2fd52d58 160000 --- a/lib/openal-soft +++ b/lib/openal-soft @@ -1 +1 @@ -Subproject commit d66107e9f008770b48f0df4fce041ee3e501e1e8 +Subproject commit 2fd52d58cd502bd4043ff4447ba1b0232ff85d28 diff --git a/src/dawn/state/StateOwner.hpp b/src/dawn/state/StateOwner.hpp index ea16c154..f7957e80 100644 --- a/src/dawn/state/StateOwner.hpp +++ b/src/dawn/state/StateOwner.hpp @@ -59,7 +59,7 @@ namespace Dawn { * @param o The old, previous value of the property. */ template - void onStatePropertyUpdated(StateProperty *prop, V n, V o) { + void _statePropertyUpdated(StateProperty *prop, V n, V o) { this->onStateUpdate(); auto eff = &this->effects[prop]; @@ -69,5 +69,17 @@ namespace Dawn { ++itEff; } } + + /** + * Internal method to listen for when a state property is disposed or + * destroyed so that it can be completely removed from this state owner. + * + * @tparam V Value type. + * @param prop Property that was destroyed. + */ + template + void _statePropertyDestroyed(StateProperty *prop) { + this->effects.erase((void*)prop); + } }; } \ No newline at end of file diff --git a/src/dawn/state/StateProperty.hpp b/src/dawn/state/StateProperty.hpp index de35589a..92d53c24 100644 --- a/src/dawn/state/StateProperty.hpp +++ b/src/dawn/state/StateProperty.hpp @@ -18,7 +18,7 @@ namespace Dawn { assertNotNull(this->owner); auto old = this->value; this->value = val; - this->owner->onStatePropertyUpdated(this, val, old); + this->owner->_statePropertyUpdated(this, val, old); } public: @@ -44,6 +44,10 @@ namespace Dawn { return this->value; } + ~StateProperty() { + this->owner->_statePropertyDestroyed(this); + } + friend class StateOwner; }; } \ No newline at end of file