summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qpodvector_p.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-20 09:22:50 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-20 09:22:50 (GMT)
commit6ed6b740e1ea9cfa64990bb2805d37197f4da45e (patch)
treed437fd6a8d0ab74ae399a22a7fa35351d19213ed /src/declarative/qml/qpodvector_p.h
parentc0a02f5c67d3de5e16fd506df83fef968e09c798 (diff)
downloadQt-6ed6b740e1ea9cfa64990bb2805d37197f4da45e.zip
Qt-6ed6b740e1ea9cfa64990bb2805d37197f4da45e.tar.gz
Qt-6ed6b740e1ea9cfa64990bb2805d37197f4da45e.tar.bz2
Prevent expression evaluation data from overlapping
Diffstat (limited to 'src/declarative/qml/qpodvector_p.h')
-rw-r--r--src/declarative/qml/qpodvector_p.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/declarative/qml/qpodvector_p.h b/src/declarative/qml/qpodvector_p.h
index e74f9f6..77f7425 100644
--- a/src/declarative/qml/qpodvector_p.h
+++ b/src/declarative/qml/qpodvector_p.h
@@ -63,6 +63,7 @@ class QPODVector
public:
QPODVector()
: m_count(0), m_capacity(0), m_data(0) {}
+ ~QPODVector() { if (m_data) ::free(m_data); }
const T &at(int idx) const {
return m_data[idx];
@@ -122,6 +123,16 @@ public:
return m_count;
}
+ void copyAndClear(QPODVector<T> &other) {
+ if (other.m_data) ::free(other.m_data);
+ other.m_count = m_count;
+ other.m_capacity = m_capacity;
+ other.m_data = m_data;
+ m_count = 0;
+ m_capacity = 0;
+ m_data = 0;
+ }
+
QPODVector<T> &operator<<(const T &v) { append(v); return *this; }
private:
QPODVector(const QPODVector &);