diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-03-14 11:22:44 -0700 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-03-16 05:05:00 +0000 |
commit | fb061e586d9a9b1122a4db5f3d4c12d3c55435a1 (patch) | |
tree | 1726ceb2aafcb82d11373d953f0a8d387e1abb31 | |
parent | 5e18f4ce0b16e9ff3101493d603bbc51b93dd2cb (diff) |
uic & rcc: use the public API to set the hash seed
Instead of relying on a private symbol exported from QtCore.
Task-number: QTBUG-47566
Change-Id: I4a7dc1fe14154695b968fffd14abd2b21a18203b
Reviewed-by: David Faure <david.faure@kdab.com>
-rw-r--r-- | src/tools/rcc/main.cpp | 10 | ||||
-rw-r--r-- | src/tools/uic/main.cpp | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp index 4e37fc7887..fba47b74c3 100644 --- a/src/tools/rcc/main.cpp +++ b/src/tools/rcc/main.cpp @@ -32,6 +32,7 @@ #include <qdir.h> #include <qfile.h> #include <qfileinfo.h> +#include <qhashfunctions.h> #include <qtextstream.h> #include <qatomic.h> #include <qglobal.h> @@ -312,16 +313,17 @@ int runRcc(int argc, char *argv[]) return 0; } -Q_CORE_EXPORT extern QBasicAtomicInt qt_qhash_seed; // from qhash.cpp - QT_END_NAMESPACE int main(int argc, char *argv[]) { // rcc uses a QHash to store files in the resource system. // we must force a certain hash order when testing or tst_rcc will fail, see QTBUG-25078 - if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QT_RCC_TEST") && !qt_qhash_seed.testAndSetRelaxed(-1, 0))) - qFatal("Cannot force QHash seed for testing as requested"); + if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QT_RCC_TEST"))) { + qSetGlobalQHashSeed(0); + if (qGlobalQHashSeed() != 0) + qFatal("Cannot force QHash seed for testing as requested"); + } return QT_PREPEND_NAMESPACE(runRcc)(argc, argv); } diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp index fca604690e..3599470403 100644 --- a/src/tools/uic/main.cpp +++ b/src/tools/uic/main.cpp @@ -32,6 +32,7 @@ #include <qfile.h> #include <qdir.h> +#include <qhashfunctions.h> #include <qtextstream.h> #include <qtextcodec.h> #include <qcoreapplication.h> @@ -39,11 +40,10 @@ #include <qcommandlineparser.h> QT_BEGIN_NAMESPACE -extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed; int runUic(int argc, char *argv[]) { - qt_qhash_seed.testAndSetRelaxed(-1, 0); // set the hash seed to 0 if it wasn't set yet + qSetGlobalQHashSeed(0); // set the hash seed to 0 QCoreApplication app(argc, argv); QCoreApplication::setApplicationVersion(QString::fromLatin1(QT_VERSION_STR)); |