From f8b681deed6298fa7c2ed7ada4752116432289cf Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 19 Jan 2013 08:26:04 -0800 Subject: [PATCH] Don't clear the pointer in QScopedPointer's destructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It helps in valgrinding applications. It's the difference between: ==17609== Address 0x38 is not stack'd, malloc'd or (recently) free'd and ==19789== Address 0x598f478 is 56 bytes inside a block of size 112 free'd ==19789== at 0x4A0736C: operator delete(void*) (vg_replace_malloc.c:480) ==19789== by 0x53A77CD: QObjectPrivate::~QObjectPrivate() (qobject.cpp:239) ==19789== by 0x53B4EB5: QScopedPointerDeleter::cleanup(QObjectData*) (qscopedpointer.h:63) ==19789== by 0x53B3980: QScopedPointer >::~QScopedPointer() (qscopedpointer.h:99) ==19789== by 0x53A8EEC: QObject::~QObject() (qobject.cpp:750) Change-Id: If42107c94401a96c05caa511442d6bd010fd4e29 Reviewed-by: Olivier Goffart Reviewed-by: Jędrzej Nowacki --- src/corelib/tools/qscopedpointer.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index fbe2aa87c1..adbf03b082 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -97,7 +97,6 @@ public: { T *oldD = this->d; Cleanup::cleanup(oldD); - this->d = 0; } inline T &operator*() const