Bug 1368326: Don't bother calling Clear() in destructor for empty nsTArrays. r?
MozReview-Commit-ID: 7mi2Os52JfJ
--- a/xpcom/ds/nsTArray.h
+++ b/xpcom/ds/nsTArray.h
@@ -874,17 +874,22 @@ public:
static const index_type NoIndex = index_type(-1);
using base_type::Length;
//
// Finalization method
//
- ~nsTArray_Impl() { Clear(); }
+ ~nsTArray_Impl()
+ {
+ if (!base_type::IsEmpty()) {
+ Clear();
+ }
+ }
//
// Initialization methods
//
nsTArray_Impl() {}
// Initialize this array and pre-allocate some number of elements.