idk if I like this structure.
This commit is contained in:
@ -45,11 +45,10 @@ void SceneComponent::dispose() {
|
||||
this->listeners.clear();
|
||||
|
||||
this->onDispose();
|
||||
this->item.reset();
|
||||
this->item = nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<SceneItem> SceneComponent::getItem() {
|
||||
auto item = this->item.lock();
|
||||
assertNotNull(item, "Item cannot be null?");
|
||||
return item;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace Dawn {
|
||||
|
||||
class SceneComponent : std::enable_shared_from_this<SceneComponent> {
|
||||
private:
|
||||
std::weak_ptr<SceneItem> item;
|
||||
std::shared_ptr<SceneItem> item;
|
||||
uint_fast8_t sceneComponentState = 0;
|
||||
|
||||
protected:
|
||||
|
@ -44,4 +44,5 @@ SceneItem::~SceneItem() {
|
||||
component->dispose();
|
||||
}
|
||||
);
|
||||
this->components.clear();
|
||||
}
|
Reference in New Issue
Block a user