Don't expect null d-pointer in destructors
The feature was introduced in commit 83497587b2 (2004, private history), to allow static containers to remain uninitialized until needed. This finishes reverting said commit. The feature had been silently removed from QByteArray and QString in commit a5a0985476 (2004, private history); removed from QList in aef03d80f7. Change-Id: I9947be7758d5730d2d6e6eb2a8a308db6e9bef39 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
a2abc11b51
commit
113e921684
@ -241,8 +241,6 @@ private:
|
||||
template <typename T>
|
||||
inline QLinkedList<T>::~QLinkedList()
|
||||
{
|
||||
if (!d)
|
||||
return;
|
||||
if (!d->ref.deref())
|
||||
free(d);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public:
|
||||
inline QMap() : d(const_cast<QMapData *>(&QMapData::shared_null)) { }
|
||||
inline QMap(const QMap<Key, T> &other) : d(other.d)
|
||||
{ d->ref.ref(); if (!d->sharable) detach(); }
|
||||
inline ~QMap() { if (!d) return; if (!d->ref.deref()) freeData(d); }
|
||||
inline ~QMap() { if (!d->ref.deref()) freeData(d); }
|
||||
|
||||
QMap<Key, T> &operator=(const QMap<Key, T> &other);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
|
@ -126,7 +126,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
inline ~QVector() { if (!d) return; if (!d->ref.deref()) free(p); }
|
||||
inline ~QVector() { if (!d->ref.deref()) free(p); }
|
||||
QVector<T> &operator=(const QVector<T> &v);
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
inline QVector<T> operator=(QVector<T> &&other)
|
||||
|
Loading…
Reference in New Issue
Block a user