Index: trunk/include/VBox/com/list.h
===================================================================
--- trunk/include/VBox/com/list.h	(revision 45126)
+++ trunk/include/VBox/com/list.h	(revision 45520)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2011 Oracle Corporation
+ * Copyright (C) 2011-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -30,5 +30,7 @@
 #include <VBox/com/ptr.h>
 #include <VBox/com/string.h>
+#include <VBox/com/array.h>
 #include <iprt/cpp/list.h>
+
 
 /**
@@ -55,6 +57,6 @@
      * @throws  std::bad_alloc
      */
-    RTCList(size_t cCapacity = BASE::DefaultCapacity)
-     : BASE(cCapacity) {}
+    RTCList(size_t cCapacity = BASE::kDefaultCapacity)
+        : BASE(cCapacity) {}
 
     /* Define our own new and delete. */
@@ -85,6 +87,6 @@
      * @throws  std::bad_alloc
      */
-    RTCList(size_t cCapacity = BASE::DefaultCapacity)
-     : BASE(cCapacity) {}
+    RTCList(size_t cCapacity = BASE::kDefaultCapacity)
+        : BASE(cCapacity) {}
 
     /* Define our own new and delete. */
@@ -98,8 +100,8 @@
  */
 template <>
-class RTCList<Utf8Str>: public RTCListBase<Utf8Str, Utf8Str*, false>
+class RTCList<com::Utf8Str>: public RTCListBase<com::Utf8Str, com::Utf8Str*, false>
 {
     /* Traits */
-    typedef Utf8Str                   T;
+    typedef com::Utf8Str              T;
     typedef T                        *ITYPE;
     static const bool                 MT = false;
@@ -115,6 +117,6 @@
      * @throws  std::bad_alloc
      */
-    RTCList(size_t cCapacity = BASE::DefaultCapacity)
-     : BASE(cCapacity) {}
+    RTCList(size_t cCapacity = BASE::kDefaultCapacity)
+        : BASE(cCapacity) {}
 
     /**
@@ -131,7 +133,8 @@
     {
         com::SafeArray<IN_BSTR> sfaOther(ComSafeArrayInArg(other));
-        realloc(sfaOther.size());
-        m_cSize = sfaOther.size();
-        for (size_t i = 0; i < m_cSize; ++i)
+        size_t const cElementsOther = sfaOther.size();
+        resizeArray(cElementsOther);
+        m_cElements = cElementsOther;
+        for (size_t i = 0; i < cElementsOther; ++i)
             RTCListHelper<T, ITYPE>::set(m_pArray, i, T(sfaOther[i]));
     }
@@ -148,7 +151,7 @@
      */
     RTCList(const com::SafeArray<IN_BSTR> &other)
-     : BASE(other.size())
-    {
-        for (size_t i = 0; i < m_cSize; ++i)
+        : BASE(other.size())
+    {
+        for (size_t i = 0; i < m_cElements; ++i)
             RTCListHelper<T, ITYPE>::set(m_pArray, i, T(other[i]));
     }
@@ -165,14 +168,17 @@
     {
         m_guard.enterWrite();
+
         /* Values cleanup */
-        RTCListHelper<T, ITYPE>::eraseRange(m_pArray, 0, m_cSize);
+        RTCListHelper<T, ITYPE>::eraseRange(m_pArray, 0, m_cElements);
+
         /* Copy */
-        if (other.size() != m_cCapacity)
-            realloc_no_elements_clean(other.size());
-        m_cSize = other.size();
-        for (size_t i = 0; i < other.size(); ++i)
+        size_t cElementsOther = other.size();
+        if (cElementsOther != m_cCapacity)
+            resizeArrayNoErase(cElementsOther);
+        m_cElements = cElementsOther;
+        for (size_t i = 0; i < cElementsOther; ++i)
             RTCListHelper<T, ITYPE>::set(m_pArray, i, T(other[i]));
+
         m_guard.leaveWrite();
-
         return *this;
     }
Index: trunk/include/VBox/com/mtlist.h
===================================================================
--- trunk/include/VBox/com/mtlist.h	(revision 45126)
+++ trunk/include/VBox/com/mtlist.h	(revision 45520)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2011 Oracle Corporation
+ * Copyright (C) 2011-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -30,4 +30,5 @@
 #include <VBox/com/ptr.h>
 #include <VBox/com/string.h>
+#include <VBox/com/array.h>
 #include <iprt/cpp/mtlist.h>
 
@@ -55,6 +56,6 @@
      * @throws  std::bad_alloc
      */
-    RTCList(size_t cCapacity = BASE::DefaultCapacity)
-     : BASE(cCapacity) {}
+    RTCMTList(size_t cCapacity = BASE::kDefaultCapacity)
+        : BASE(cCapacity) {}
 
     /* Define our own new and delete. */
@@ -85,5 +86,5 @@
      * @throws  std::bad_alloc
      */
-    RTCList(size_t cCapacity = BASE::DefaultCapacity)
+    RTCMTList(size_t cCapacity = BASE::kDefaultCapacity)
      : BASE(cCapacity) {}
 
@@ -98,8 +99,8 @@
  */
 template <>
-class RTCMTList<Utf8Str>: public RTCListBase<Utf8Str, Utf8Str*, true>
+class RTCMTList<com::Utf8Str>: public RTCListBase<com::Utf8Str, com::Utf8Str *, true>
 {
     /* Traits */
-    typedef Utf8Str                   T;
+    typedef com::Utf8Str              T;
     typedef T                        *ITYPE;
     static const bool                 MT = true;
@@ -115,6 +116,6 @@
      * @throws  std::bad_alloc
      */
-    RTCMTList(size_t cCapacity = BASE::DefaultCapacity)
-     : BASE(cCapacity) {}
+    RTCMTList(size_t cCapacity = BASE::kDefaultCapacity)
+        : BASE(cCapacity) {}
 
     /**
@@ -131,7 +132,8 @@
     {
         com::SafeArray<IN_BSTR> sfaOther(ComSafeArrayInArg(other));
-        realloc(sfaOther.size());
-        m_cSize = sfaOther.size();
-        for (size_t i = 0; i < m_cSize; ++i)
+        size_t const cElementsOther = sfaOther.size();
+        resizeArray(cElementsOther);
+        m_cElements = cElementsOther;
+        for (size_t i = 0; i < cElementsOther; ++i)
             RTCListHelper<T, ITYPE>::set(m_pArray, i, T(sfaOther[i]));
     }
@@ -150,5 +152,5 @@
       : BASE(other.size())
     {
-        for (size_t i = 0; i < m_cSize; ++i)
+        for (size_t i = 0; i < m_cElements; ++i)
             RTCListHelper<T, ITYPE>::set(m_pArray, i, T(other[i]));
     }
@@ -166,9 +168,9 @@
         m_guard.enterWrite();
          /* Values cleanup */
-        RTCListHelper<T, ITYPE>::eraseRange(m_pArray, 0, m_cSize);
+        RTCListHelper<T, ITYPE>::eraseRange(m_pArray, 0, m_cElements);
         /* Copy */
         if (other.size() != m_cCapacity)
-            realloc_no_elements_clean(other.size());
-        m_cSize = other.size();
+            resizeArrayNoErase(other.size());
+        m_cElements = other.size();
         for (size_t i = 0; i < other.size(); ++i)
             RTCListHelper<T, ITYPE>::set(m_pArray, i, T(other[i]));
