diff options
author | Robert Loehning <robert.loehning@digia.com> | 2014-07-24 14:16:08 (GMT) |
---|---|---|
committer | Robert Loehning <robert.loehning@digia.com> | 2014-07-25 13:22:47 (GMT) |
commit | 98530cbc3a0bbb633bab96eebb535d7f92ecb1fa (patch) | |
tree | b922681ea916c41197c04dec961350500435cb85 /tools/assistant | |
parent | bc620055c82a8ccae49144ad99bf9226d659f852 (diff) | |
download | Qt-98530cbc3a0bbb633bab96eebb535d7f92ecb1fa.zip Qt-98530cbc3a0bbb633bab96eebb535d7f92ecb1fa.tar.gz Qt-98530cbc3a0bbb633bab96eebb535d7f92ecb1fa.tar.bz2 |
Fix crashes in QtHelp when too many connections are made
Backported from change 6481e28ba0d696cf41a2a5bc32b01db85f95b333 in qtbase
Task-number: QTBUG-36480
Change-Id: I3625d57a2f7b7b2f763a4cb92f19025b0401c593
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'tools/assistant')
-rw-r--r-- | tools/assistant/lib/qhelp_global.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/assistant/lib/qhelp_global.cpp b/tools/assistant/lib/qhelp_global.cpp index 64974c1..e9c461a 100644 --- a/tools/assistant/lib/qhelp_global.cpp +++ b/tools/assistant/lib/qhelp_global.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include <QtCore/QCoreApplication> +#include <QtCore/QHash> #include <QtCore/QRegExp> #include <QtCore/QMutexLocker> #include <QtGui/QTextDocument> @@ -48,15 +49,12 @@ QString QHelpGlobal::uniquifyConnectionName(const QString &name, void *pointer) { - static int counter = 0; static QMutex mutex; - QMutexLocker locker(&mutex); - if (++counter > 1000) - counter = 0; + static QHash<QString,quint16> idHash; return QString::fromLatin1("%1-%2-%3"). - arg(name).arg(quintptr(pointer)).arg(counter); + arg(name).arg(quintptr(pointer)).arg(++idHash[name]); } QString QHelpGlobal::documentTitle(const QString &content) |