From c7251e7dcd624b8225a2f9b2f14e6f73d1c09a60 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 24 Nov 2015 10:39:49 +0100 Subject: Revert "Fix deadlock when setting environment variables." This reverts commit 5b62a5e7aabcc818408f2fe28b9760082f474def. This commit is reverted due to two reasons: 1) It was written incorrectly and does not work as is. The ifdefs should be ifndefs. In its current state, it does the exact opposite of what it is supposed to be doing. 2) There is another environment access inside qsimd.cpp (which checks QT_NO_CPU_FEATURE). This access causes the app to hang. All in all that approach is not sustainable as we might get bitten by environment access again and again. Instead we should use another environment container or use a recursive mutex for WinRT and Windows CE. Task-number: QTBUG-49529 Change-Id: Iaca76404dc1023551a7c25489a609681135765fd Reviewed-by: Andrew Knight Reviewed-by: Samuel Nevala --- src/corelib/tools/qhash.cpp | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src/corelib/tools/qhash.cpp') diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index fe49e8c6a8..b334a697a9 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -38,14 +38,6 @@ #ifndef _CRT_RAND_S #define _CRT_RAND_S #endif - -// Windows Runtime and CE use a QHash to fake environment variables. To avoid -// deadlock, disable reading the QT_HASH_SEED environment variable within -// QHash. -#if defined(Q_OS_WINRT) || defined(Q_OS_WINCE) -# define QHASH_NO_ENV_SEED -#endif - #include #include "qhash.h" @@ -231,11 +223,9 @@ static uint qt_create_qhash_seed() uint seed = 0; #ifndef QT_BOOTSTRAPPED -#ifdef QHASH_NO_ENV_SEED QByteArray envSeed = qgetenv("QT_HASH_SEED"); if (!envSeed.isNull()) return envSeed.toUInt(); -#endif // QHASH_NO_ENV_SEED #ifdef Q_OS_UNIX int randomfd = qt_safe_open("/dev/urandom", O_RDONLY); @@ -337,10 +327,8 @@ int qGlobalQHashSeed() */ void qSetGlobalQHashSeed(int newSeed) { -#ifdef QHASH_NO_ENV_SEED if (qEnvironmentVariableIsSet("QT_HASH_SEED")) return; -#endif // QHASH_NO_ENV_SEED if (newSeed == -1) { int x(qt_create_qhash_seed() & INT_MAX); qt_qhash_seed.store(x); @@ -1194,9 +1182,6 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW decimal value, will be used as the seed for qHash(). Alternatively, you can call the qSetGlobalQHashSeed() function. - \note The environment variable \c QT_HASH_SEED is unsupported on Windows - Runtime and CE. Use qSetGlobalQHashSeed() instead on those platforms. - \sa QHashIterator, QMutableHashIterator, QMap, QSet */ -- cgit v1.2.3