diff options
Diffstat (limited to 'core/self_list.h')
-rw-r--r-- | core/self_list.h | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/core/self_list.h b/core/self_list.h index 2c44b0caec..74c585e60e 100644 --- a/core/self_list.h +++ b/core/self_list.h @@ -39,8 +39,8 @@ class SelfList { public: class List { - SelfList<T> *_first; - SelfList<T> *_last; + SelfList<T> *_first = nullptr; + SelfList<T> *_last = nullptr; public: void add(SelfList<T> *p_elem) { @@ -105,18 +105,16 @@ public: _FORCE_INLINE_ SelfList<T> *first() { return _first; } _FORCE_INLINE_ const SelfList<T> *first() const { return _first; } - _FORCE_INLINE_ List() { - _first = nullptr; - _last = nullptr; - } + + _FORCE_INLINE_ List() {} _FORCE_INLINE_ ~List() { ERR_FAIL_COND(_first != nullptr); } }; private: - List *_root; + List *_root = nullptr; T *_self; - SelfList<T> *_next; - SelfList<T> *_prev; + SelfList<T> *_next = nullptr; + SelfList<T> *_prev = nullptr; public: _FORCE_INLINE_ bool in_list() const { return _root; } @@ -131,15 +129,10 @@ public: _FORCE_INLINE_ T *self() const { return _self; } _FORCE_INLINE_ SelfList(T *p_self) { - _self = p_self; - _next = nullptr; - _prev = nullptr; - _root = nullptr; } _FORCE_INLINE_ ~SelfList() { - if (_root) _root->remove(this); } |