From 95dd8a45b0da50fb32843dd275b2028ce77b2492 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 9 Mar 2010 17:16:02 +0100 Subject: Memory leak! Multiple insertions of the same (key, value) pair in a QMultiHash. Reviewed-by: Olivier Task-number: QTBUG-8862 --- src/gui/text/qtextformat.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index dca2da5..140cf43 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -3085,7 +3085,8 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format) f.d = new QTextFormatPrivate; f.d->resolveFont(defaultFnt); - hashes.insert(hash, idx); + if (!hashes.contains(hash, idx)) + hashes.insert(hash, idx); } QT_CATCH(...) { formats.pop_back(); -- cgit v0.12