Bug 1359653: Part 3 - Add a Clear() method to AutoCleanLinkedList. r?waldo draft
authorKris Maglione <maglione.k@gmail.com>
Thu, 27 Apr 2017 21:15:09 -0700
changeset 570372 1d04e935773ada5045798a31194de3a5767279a6
parent 570371 12abb113b05de62352182de4b377e521d183a77a
child 570373 c870ccf566f3b57e672ab15ce6203c280db310f3
push id56465
push usermaglione.k@gmail.com
push dateFri, 28 Apr 2017 19:36:32 +0000
reviewerswaldo
bugs1359653
milestone55.0a1
Bug 1359653: Part 3 - Add a Clear() method to AutoCleanLinkedList. r?waldo MozReview-Commit-ID: 2bUTMPviJzg
mfbt/LinkedList.h
--- a/mfbt/LinkedList.h
+++ b/mfbt/LinkedList.h
@@ -643,16 +643,21 @@ private:
 };
 
 template <typename T>
 class AutoCleanLinkedList : public LinkedList<T>
 {
 public:
   ~AutoCleanLinkedList()
   {
+    Clear();
+  }
+
+  void Clear()
+  {
     while (T* element = this->popFirst()) {
       delete element;
     }
   }
 };
 
 } /* namespace mozilla */