diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-29 20:11:00 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-29 20:11:00 (GMT) |
commit | e8c01ab0e5fb6134617a69d88ed0cbce24a33da5 (patch) | |
tree | 67e19820ef67dcc3b0cadb7abdbcd03550a5df32 /src/corelib/io | |
parent | 90f885a7fea4afb719629967567353db84085ea0 (diff) | |
parent | 66b9f79a9577ee50ca0a9ef8a2ac7a09a3e68a50 (diff) | |
download | Qt-e8c01ab0e5fb6134617a69d88ed0cbce24a33da5.zip Qt-e8c01ab0e5fb6134617a69d88ed0cbce24a33da5.tar.gz Qt-e8c01ab0e5fb6134617a69d88ed0cbce24a33da5.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
dbus does not use this. fix build.
Fix memory leak on exit
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qsettings.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 53af822..8ee42e7 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1231,16 +1231,21 @@ QConfFileSettingsPrivate::~QConfFileSettingsPrivate() if (confFiles[i] && !confFiles[i]->ref.deref()) { if (confFiles[i]->size == 0) { delete confFiles[i].take(); - } else if (unusedCache) { + } else { if (usedHash) usedHash->remove(confFiles[i]->name); - QT_TRY { - // compute a better size? - unusedCache->insert(confFiles[i]->name, confFiles[i].data(), - 10 + (confFiles[i]->originalKeys.size() / 4)); - confFiles[i].take(); - } QT_CATCH(...) { - // out of memory. Do not cache the file. + if (unusedCache) { + QT_TRY { + // compute a better size? + unusedCache->insert(confFiles[i]->name, confFiles[i].data(), + 10 + (confFiles[i]->originalKeys.size() / 4)); + confFiles[i].take(); + } QT_CATCH(...) { + // out of memory. Do not cache the file. + delete confFiles[i].take(); + } + } else { + // unusedCache is gone - delete the entry to prevent a memory leak delete confFiles[i].take(); } } |