From 449390c3a5f3a91e3895cbba0a583386e93366b7 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 21 Aug 2016 22:49:35 +0300 Subject: Revert "QLocale: Actually get the language script for the system locale" The text direction should *not* be set by the default script, but by the UI direction. For example, if the default script is Hebrew, but the UI is in English, it doesn't make sense to default all the controls to RTL. This should be done only if the UI is RTL. This reverts commit a90869861cbc9927af2bbab5a94630e47b33fd5c. Task-number: QTBUG-53110 Change-Id: I5a6951ac30f24eec86bc0ae2a9fcfe14eb3a8e28 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale_win.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index a5eb7ec058..7faf36b089 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -841,7 +841,6 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case ZeroDigit: return d->zeroDigit(); case LanguageId: - case ScriptId: case CountryId: { QString locale = QString::fromLatin1(getWinLocaleName()); QLocale::Language lang; @@ -850,12 +849,12 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const QLocalePrivate::getLangAndCountry(locale, lang, script, cntry); if (type == LanguageId) return lang; - if (type == ScriptId) - return script == QLocale::AnyScript ? fallbackUiLocale().script() : script; if (cntry == QLocale::AnyCountry) return fallbackUiLocale().country(); return cntry; } + case ScriptId: + return QVariant(QLocale::AnyScript); case MeasurementSystem: return d->measurementSystem(); case AMText: -- cgit v1.2.3 From 5e3f770ad5e47f296b4782c0b6c5b03162027500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Thu, 18 Aug 2016 11:44:45 +0200 Subject: Fix problem with exception reporting in QFuture::waitForResult() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a problem that occurs when a task, that is run synchronously, throws an exception. If that happened, then the exception would not be re-thrown, because of an early return. Task-number: QTBUG-54831 Change-Id: Ic70c5b810ec6adce6e62bfd6832ba9f170b13a7f Reviewed-by: Jędrzej Nowacki --- src/corelib/thread/qfutureinterface.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp index 60155c96fd..2fe038165b 100644 --- a/src/corelib/thread/qfutureinterface.cpp +++ b/src/corelib/thread/qfutureinterface.cpp @@ -299,12 +299,11 @@ void QFutureInterfaceBase::waitForResult(int resultIndex) lock.relock(); - if (!(d->state & Running)) - return; - - const int waitIndex = (resultIndex == -1) ? INT_MAX : resultIndex; - while ((d->state & Running) && d->internal_isResultReadyAt(waitIndex) == false) - d->waitCondition.wait(&d->m_mutex); + if (d->state & Running) { + const int waitIndex = (resultIndex == -1) ? INT_MAX : resultIndex; + while ((d->state & Running) && d->internal_isResultReadyAt(waitIndex) == false) + d->waitCondition.wait(&d->m_mutex); + } d->m_exceptionStore.throwPossibleException(); } -- cgit v1.2.3 From 680ec54a76eaf63375f648819ac9f98c915e5c43 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Mon, 22 Aug 2016 19:55:10 +0200 Subject: QMutex: Make freelist() return a real global static Since Qt 5.6.0, some applications such as Kate (built with clang, libc++ and libcxxrt) on FreeBSD occasionally crash with the following error message on exit: QMutex::lock(): sem_wait failure: Invalid argument [or pthread_cond_wait in the 5.6 branch] Investigation by Gleb Popov, Thiago Macieira and Olivier Goffart has shown that this is caused by the fact that QDBusConnectionManager is a Q_GLOBAL_STATIC (so it will be destroyed with all the other Q_GLOBAL_STATICs in the reverse order of construction). In the Q_COMPILER_THREADSAFE_STATICS case, freelist() also returns a function-level static that is constructed on first use, so it may be destroyed earlier than the QDBusConnectionManager object, making it impossible to lock a contended mutex. We now make freelist() return a global static, so that it is always destroyed after QDBusConnectionManager and other function-static variables. Change-Id: I210fa7c18dbdf2345863da49141b9a85cffdef52 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/thread/qmutex.cpp | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index fa3bb080ae..e9709e34c5 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -571,34 +571,11 @@ const int FreeListConstants::Sizes[FreeListConstants::BlockCount] = { typedef QFreeList FreeList; // We cannot use Q_GLOBAL_STATIC because it uses QMutex -#if defined(Q_COMPILER_THREADSAFE_STATICS) +static FreeList freeList_; FreeList *freelist() { - static FreeList list; - return &list; + return &freeList_; } -#else -static QBasicAtomicPointer freeListPtr; - -FreeList *freelist() -{ - FreeList *local = freeListPtr.loadAcquire(); - if (!local) { - local = new FreeList; - if (!freeListPtr.testAndSetRelease(0, local)) { - delete local; - local = freeListPtr.loadAcquire(); - } - } - return local; -} - -static void qFreeListDeleter() -{ - delete freeListPtr.load(); -} -Q_DESTRUCTOR_FUNCTION(qFreeListDeleter) -#endif } QMutexPrivate *QMutexPrivate::allocate() -- cgit v1.2.3 From 3e453abc7d27066d444545ddbf9b4d7576dc7efb Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 16 Aug 2016 13:40:09 +0200 Subject: QMimeType: use default locale rather than system locale This makes it possible for the application to control which language is used by QMimeType::comment() [ChangeLog][QtCore][QMimeType] QMimeType::comment() now uses the default locale rather than system locale, so that applications can control which language is being used. Task-number: QTBUG-50776 Change-Id: I82623b7c488035a4164fadaf37ebcc79a9fd6173 Reviewed-by: Thiago Macieira --- src/corelib/mimetypes/qmimeprovider.cpp | 2 +- src/corelib/mimetypes/qmimetype.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index 0c64db4d48..fbd14e2d5d 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -576,7 +576,7 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data) QString comment; QString mainPattern; - const QString preferredLanguage = QLocale::system().name(); + const QString preferredLanguage = QLocale().name(); for (QStringList::const_reverse_iterator it = mimeFiles.crbegin(), end = mimeFiles.crend(); it != end; ++it) { // global first, then local. QFile qfile(*it); diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp index e3b01bbb89..980e8c1e5e 100644 --- a/src/corelib/mimetypes/qmimetype.cpp +++ b/src/corelib/mimetypes/qmimetype.cpp @@ -232,15 +232,15 @@ QString QMimeType::name() const /*! Returns the description of the MIME type to be displayed on user interfaces. - The system language (QLocale::system().name()) is used to select the appropriate translation. + The default language (QLocale().name()) is used to select the appropriate translation. */ QString QMimeType::comment() const { QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d); QStringList languageList; - languageList << QLocale::system().name(); - languageList << QLocale::system().uiLanguages(); + languageList << QLocale().name(); + languageList << QLocale().uiLanguages(); Q_FOREACH (const QString &language, languageList) { const QString lang = language == QLatin1String("C") ? QLatin1String("en_US") : language; const QString comm = d->localeComments.value(lang); -- cgit v1.2.3