fix fatal bug in wxVector copy ctor

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54964 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-08-03 23:58:24 +00:00
parent 95434bcfc3
commit a470957ada

View File

@@ -124,7 +124,7 @@ public:
wxVector() : m_size(0), m_capacity(0), m_values(NULL) {} wxVector() : m_size(0), m_capacity(0), m_values(NULL) {}
wxVector(const wxVector& c) wxVector(const wxVector& c) : m_size(0), m_capacity(0), m_values(NULL)
{ {
Copy(c); Copy(c);
} }
@@ -144,7 +144,8 @@ public:
Ops::Free(m_values); Ops::Free(m_values);
m_values = NULL; m_values = NULL;
m_size = m_capacity = 0; m_size =
m_capacity = 0;
} }
void reserve(size_type n) void reserve(size_type n)
@@ -184,6 +185,7 @@ public:
wxVector& operator=(const wxVector& vb) wxVector& operator=(const wxVector& vb)
{ {
clear();
Copy(vb); Copy(vb);
return *this; return *this;
} }
@@ -321,7 +323,6 @@ private:
void Copy(const wxVector& vb) void Copy(const wxVector& vb)
{ {
clear();
reserve(vb.size()); reserve(vb.size());
for ( const_iterator i = vb.begin(); i != vb.end(); ++i ) for ( const_iterator i = vb.begin(); i != vb.end(); ++i )