From 47065844f666e1332a7fb5bcfdc6015e0f7e1591 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 25 Oct 2016 00:19:55 +0200 Subject: Replace QStringLiteral with QLatin1String in the proxy themes This allows us, in theory, to test multiple styles in the same process by calling qmlClearTypeRegistrations() between each style test round. When QML types are cleared, QML plugins are unloaded, and the current style plugin's proxy platform theme is destroyed. It leads to a nasty crash if there are fonts stored in the Qt font database that have their family names stored in the read-only data of an unloaded plugin. Change-Id: I32a70077ac4502e16a753fb68f7efeef35d239b5 Reviewed-by: Mitch Curtis --- src/imports/controls/material/qquickmaterialtheme.cpp | 8 ++++---- src/imports/controls/universal/qquickuniversaltheme.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp index 0d2f8a70..1967a74b 100644 --- a/src/imports/controls/material/qquickmaterialtheme.cpp +++ b/src/imports/controls/material/qquickmaterialtheme.cpp @@ -45,15 +45,15 @@ QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme) : QQuickProxyTheme(theme) { QFont font; - font.setFamily(QStringLiteral("Roboto")); + font.setFamily(QLatin1String("Roboto")); QString family = QFontInfo(font).family(); - if (family != QStringLiteral("Roboto")) { - font.setFamily(QStringLiteral("Noto")); + if (family != QLatin1String("Roboto")) { + font.setFamily(QLatin1String("Noto")); family = QFontInfo(font).family(); } - if (family == QStringLiteral("Roboto") || family == QStringLiteral("Noto")) { + if (family == QLatin1String("Roboto") || family == QLatin1String("Noto")) { systemFont.setFamily(family); buttonFont.setFamily(family); toolTipFont.setFamily(family); diff --git a/src/imports/controls/universal/qquickuniversaltheme.cpp b/src/imports/controls/universal/qquickuniversaltheme.cpp index 51642c4a..dc516b45 100644 --- a/src/imports/controls/universal/qquickuniversaltheme.cpp +++ b/src/imports/controls/universal/qquickuniversaltheme.cpp @@ -44,8 +44,8 @@ QT_BEGIN_NAMESPACE QQuickUniversalTheme::QQuickUniversalTheme(QPlatformTheme *theme) : QQuickProxyTheme(theme) { - const QFont font(QStringLiteral("Segoe UI")); - if (QFontInfo(font).family() == QStringLiteral("Segoe UI")) { + const QFont font(QLatin1String("Segoe UI")); + if (QFontInfo(font).family() == QLatin1String("Segoe UI")) { const QString family = font.family(); systemFont.setFamily(family); groupBoxTitleFont.setFamily(family); -- cgit v1.2.3