diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-21 18:20:14 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-21 18:20:14 (GMT) |
commit | b15fbecb8a141c12282481529d3b2e1f0d5d9026 (patch) | |
tree | 561f0acf0ae986478e9995174f915841c1867002 | |
parent | 7a7ea0219f6ebb9f7833649ec76e077796be1843 (diff) | |
download | Qt-b15fbecb8a141c12282481529d3b2e1f0d5d9026.zip Qt-b15fbecb8a141c12282481529d3b2e1f0d5d9026.tar.gz Qt-b15fbecb8a141c12282481529d3b2e1f0d5d9026.tar.bz2 |
Don't access usedHashFunc() if it's already been deleted.
Problem spotted in Designer:
==13197== Invalid read of size 4
==13197== at 0x5C9AD2A: QHash<QString, QConfFile*>::isEmpty() const (qhash.h:283)
==13197== by 0x5C98142: QHash<QString, QConfFile*>::remove(QString const&) (qhash.h:769)
==13197== by 0x5C8C9FF: QConfFile::~QConfFile() (qsettings.cpp:226)
==13197== by 0x5C9238E: QConfFileSettingsPrivate::~QConfFileSettingsPrivate() (qsettings.cpp:1228)
==13197== by 0x5C9D7AA: QScopedPointerDeleter<QObjectData>::cleanup(QObjectData*) (qscopedpointer.h:62)
==13197== by 0x5CF11A4: QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer() (qscopedpointer.h:100)
==13197== by 0x5CE9B46: QObject::~QObject() (qobject.cpp:992)
==13197== by 0x5C95C90: QSettings::~QSettings() (qsettings.cpp:2754)
==13197== by 0x5CC1FDC: LibraryData::~LibraryData() (qlibrary.cpp:428)
==13197== by 0x5CC2441: QGlobalStaticDeleter<LibraryData>::~QGlobalStaticDeleter() (qglobal.h:1767)
==13197== by 0x5FE16DE: __run_exit_handlers (exit.c:78)
==13197== by 0x5FE174E: exit (exit.c:100)
==13197== by 0x5FCBA3D: (below main) (libc-start.c:252)
==13197== Address 0x0 is not stack'd, malloc'd or (recently) free'd
-rw-r--r-- | src/corelib/io/qsettings.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 4c19cbf..8612e03 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -223,7 +223,8 @@ QConfFile::QConfFile(const QString &fileName, bool _userPerms) QConfFile::~QConfFile() { - usedHashFunc()->remove(name); + if (usedHashFunc()) + usedHashFunc()->remove(name); } ParsedSettingsMap QConfFile::mergedKeyMap() const |