summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-01-28 18:27:28 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-01-28 18:28:27 +0100
commit4cbadf699838406d14366ce61deec03cf45113f7 (patch)
treeb4f22e81025a584aaef93f9a0919d7829bd77de2 /src/corelib
parent1bd60749d140d14d152b59eccbda4790c517c54e (diff)
parenta4ea0d9eacd574a6a96f70b138dcb111e9d11d21 (diff)
Merge "Merge remote-tracking branch 'origin/5.15' into dev"
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qlibraryinfo.cpp21
-rw-r--r--src/corelib/global/qnamespace.qdoc2
-rw-r--r--src/corelib/serialization/qxmlstream.cpp14
-rw-r--r--src/corelib/serialization/qxmlstream_p.h2
-rw-r--r--src/corelib/text/qlocale.cpp12
-rw-r--r--src/corelib/text/text.pri2
6 files changed, 38 insertions, 15 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 9fab49a73e..73597b6bcc 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -534,8 +534,25 @@ static QString getRelocatablePrefix()
#if defined(QT_STATIC)
prefixPath = prefixFromAppDirHelper();
#elif defined(Q_OS_DARWIN) && QT_CONFIG(framework)
- CFBundleRef qtCoreBundle = CFBundleGetBundleWithIdentifier(
- CFSTR("org.qt-project.QtCore"));
+ auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtCore"));
+ if (!qtCoreBundle) {
+ // When running Qt apps over Samba shares, CoreFoundation will fail to find
+ // the Resources directory inside the bundle, This directory is a symlink,
+ // and CF relies on readdir() and dtent.dt_type to detect symlinks, which
+ // does not work reliably for Samba shares. We work around it by manually
+ // looking for the QtCore bundle.
+ auto allBundles = CFBundleGetAllBundles();
+ auto bundleCount = CFArrayGetCount(allBundles);
+ for (int i = 0; i < bundleCount; ++i) {
+ auto bundle = CFBundleRef(CFArrayGetValueAtIndex(allBundles, i));
+ auto url = QCFType<CFURLRef>(CFBundleCopyBundleURL(bundle));
+ auto path = QCFType<CFStringRef>(CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle));
+ if (CFStringHasSuffix(path, CFSTR("/QtCore.framework"))) {
+ qtCoreBundle = bundle;
+ break;
+ }
+ }
+ }
Q_ASSERT(qtCoreBundle);
QCFType<CFURLRef> qtCorePath = CFBundleCopyBundleURL(qtCoreBundle);
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 29b58783d5..9acb978efc 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1023,7 +1023,7 @@
\value WA_MacNoClickThrough This value is obsolete and has no effect.
- \value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip
+ \value WA_MacOpaqueSizeGrip Indicates that the native size grip
should be opaque instead of transparent (the default). This attribute
is only applicable to \macos and is set by the widget's author.
diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp
index 500e0aa6be..7ff87885a5 100644
--- a/src/corelib/serialization/qxmlstream.cpp
+++ b/src/corelib/serialization/qxmlstream.cpp
@@ -50,6 +50,7 @@
#endif
#include <qstack.h>
#include <qbuffer.h>
+#include <qscopeguard.h>
#ifndef QT_BOOTSTRAPPED
#include <qcoreapplication.h>
#else
@@ -68,6 +69,8 @@ public: \
{ return QString::fromLatin1(sourceText); } \
private:
#endif
+#include <private/qmemory_p.h>
+
QT_BEGIN_NAMESPACE
#include "qxmlstream_p.h"
@@ -847,7 +850,7 @@ void QXmlStreamReaderPrivate::init()
#endif
attributeStack.clear();
attributeStack.reserve(16);
- entityParser = nullptr;
+ entityParser.reset();
hasCheckedStartDocument = false;
normalizeLiterals = false;
hasSeenTag = false;
@@ -880,7 +883,7 @@ void QXmlStreamReaderPrivate::parseEntity(const QString &value)
if (!entityParser)
- entityParser = new QXmlStreamReaderPrivate(q);
+ entityParser = qt_make_unique<QXmlStreamReaderPrivate>(q);
else
entityParser->init();
entityParser->inParseEntity = true;
@@ -910,7 +913,6 @@ QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate()
#endif
free(sym_stack);
free(state_stack);
- delete entityParser;
}
@@ -1582,6 +1584,7 @@ QStringRef QXmlStreamReaderPrivate::namespaceForPrefix(const QStringRef &prefix)
*/
void QXmlStreamReaderPrivate::resolveTag()
{
+ const auto attributeStackCleaner = qScopeGuard([this](){ attributeStack.clear(); });
int n = attributeStack.size();
if (namespaceProcessing) {
@@ -1649,7 +1652,10 @@ void QXmlStreamReaderPrivate::resolveTag()
if (attributes[j].name() == attribute.name()
&& attributes[j].namespaceUri() == attribute.namespaceUri()
&& (namespaceProcessing || attributes[j].qualifiedName() == attribute.qualifiedName()))
+ {
raiseWellFormedError(QXmlStream::tr("Attribute '%1' redefined.").arg(attribute.qualifiedName()));
+ return;
+ }
}
}
@@ -1680,8 +1686,6 @@ void QXmlStreamReaderPrivate::resolveTag()
attribute.m_isDefault = true;
attributes.append(attribute);
}
-
- attributeStack.clear();
}
void QXmlStreamReaderPrivate::resolvePublicNamespaces()
diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h
index cde66a48a3..9c94e6d434 100644
--- a/src/corelib/serialization/qxmlstream_p.h
+++ b/src/corelib/serialization/qxmlstream_p.h
@@ -981,7 +981,7 @@ public:
QString resolveUndeclaredEntity(const QString &name);
void parseEntity(const QString &value);
- QXmlStreamReaderPrivate *entityParser;
+ std::unique_ptr<QXmlStreamReaderPrivate> entityParser;
bool scanAfterLangleBang();
bool scanPublicOrSystem();
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index fb45b82967..6dbec8ba33 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -734,23 +734,23 @@ static void updateSystemPrivate()
globalLocaleData.m_script_id = res.toInt();
res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant());
- if (!res.isNull())
+ if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_decimal = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant());
- if (!res.isNull())
+ if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_group = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant());
- if (!res.isNull())
+ if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_zero = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::NegativeSign, QVariant());
- if (!res.isNull())
+ if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_minus = res.toString().at(0).unicode();
res = sys_locale->query(QSystemLocale::PositiveSign, QVariant());
- if (!res.isNull())
+ if (!res.isNull() && !res.toString().isEmpty())
globalLocaleData.m_plus = res.toString().at(0).unicode();
}
#endif // !QT_NO_SYSTEMLOCALE
@@ -4463,6 +4463,8 @@ QStringList QLocale::uiLanguages() const
for (const auto entry : qAsConst(uiLanguages))
locales.append(QLocale(entry));
}
+ if (locales.isEmpty())
+ locales.append(systemLocale()->fallbackUiLocale());
} else
#endif
{
diff --git a/src/corelib/text/text.pri b/src/corelib/text/text.pri
index 25e281f37a..d2a02059c7 100644
--- a/src/corelib/text/text.pri
+++ b/src/corelib/text/text.pri
@@ -48,7 +48,7 @@ SOURCES += \
NO_PCH_SOURCES += text/qstring_compat.cpp
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
-!nacl:macos: {
+!nacl:darwin: {
SOURCES += text/qlocale_mac.mm
}
else:unix {