summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/kernel/qvariant.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index cea893ba0c..2ac1bb11fb 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -3632,11 +3632,13 @@ QSequentialIterable::const_iterator::const_iterator(const const_iterator &other)
QSequentialIterable::const_iterator&
QSequentialIterable::const_iterator::operator=(const const_iterator &other)
{
- if (!m_impl.equal(other.m_impl)) {
- m_impl = other.m_impl;
- ref = other.ref;
+ other.ref->ref();
+ if (!ref->deref()) {
+ m_impl.destroyIter();
+ delete ref;
}
- ref->ref();
+ m_impl = other.m_impl;
+ ref = other.ref;
return *this;
}
@@ -3941,11 +3943,13 @@ QAssociativeIterable::const_iterator::const_iterator(const const_iterator &other
QAssociativeIterable::const_iterator&
QAssociativeIterable::const_iterator::operator=(const const_iterator &other)
{
- if (!m_impl.equal(other.m_impl)) {
- m_impl = other.m_impl;
- ref = other.ref;
+ other.ref->ref();
+ if (!ref->deref()) {
+ m_impl.destroyIter();
+ delete ref;
}
- ref->ref();
+ m_impl = other.m_impl;
+ ref = other.ref;
return *this;
}