diff options
-rw-r--r-- | common/list.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/common/list.h b/common/list.h index b05a2b4e16..4b5d95df0d 100644 --- a/common/list.h +++ b/common/list.h @@ -192,7 +192,15 @@ public: } void clear() { - erase(begin(), end()); + NodeBase *pos = _anchor._next; + while (pos != &_anchor) { + Node *node = static_cast<Node *>(pos); + pos = pos->_next; + delete node; + } + + _anchor._prev = &_anchor; + _anchor._next = &_anchor; } bool empty() const { |