Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I03d82c5bc47908a97e7a908d7e67a7301b28d8cb
This commit is contained in:
commit
74858dc4af
@ -103,10 +103,13 @@ typedef QList<QByteArray>::ConstIterator ByteArrayListConstIt;
|
||||
|
||||
Q_GLOBAL_STATIC(QRecursiveMutex, textCodecsMutex);
|
||||
|
||||
class TextCodecsMutexLocker {
|
||||
class TextCodecsMutexLocker
|
||||
{
|
||||
using Lock = decltype(qt_unique_lock(std::declval<QRecursiveMutex&>()));
|
||||
// ### FIXME: this is used when textCodecsMutex already == nullptr
|
||||
const Lock lock = qt_unique_lock(textCodecsMutex());
|
||||
public:
|
||||
TextCodecsMutexLocker() {} // required d/t an ICC 19 bug
|
||||
};
|
||||
|
||||
#if !QT_CONFIG(icu)
|
||||
|
@ -338,7 +338,16 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i
|
||||
}
|
||||
}
|
||||
|
||||
if (!d_ptr->context->makeCurrent(window)) {
|
||||
bool current = d_ptr->context->makeCurrent(window);
|
||||
|
||||
if (!current && !d_ptr->context->isValid()) {
|
||||
delete d_ptr->blitter;
|
||||
d_ptr->blitter = nullptr;
|
||||
d_ptr->textureId = 0;
|
||||
current = d_ptr->context->create() && d_ptr->context->makeCurrent(window);
|
||||
}
|
||||
|
||||
if (!current) {
|
||||
qCWarning(lcQpaBackingStore, "composeAndFlush: makeCurrent() failed");
|
||||
return;
|
||||
}
|
||||
|
@ -3176,8 +3176,7 @@ QDebug operator<<(QDebug stream, const QFont &font)
|
||||
QDebug debug(&fontDescription);
|
||||
debug.nospace();
|
||||
|
||||
QFontPrivate priv;
|
||||
const QFont defaultFont(&priv);
|
||||
const QFont defaultFont(new QFontPrivate);
|
||||
|
||||
for (int property = QFont::FamilyResolved; property < QFont::AllPropertiesResolved; property <<= 1) {
|
||||
const bool resolved = (font.resolve_mask & property) != 0;
|
||||
|
@ -2684,7 +2684,7 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
|
||||
QtFontDesc desc;
|
||||
QList<int> blackListed;
|
||||
int index = match(multi ? QChar::Script_Common : script, request, family_name, foundry_name, &desc, blackListed);
|
||||
if (index < 0 && QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamilyAliases()) {
|
||||
if (index < 0 && QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamilyAliases(family_name)) {
|
||||
// We populated familiy aliases (e.g. localized families), so try again
|
||||
index = match(multi ? QChar::Script_Common : script, request, family_name, foundry_name, &desc, blackListed);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class Q_GUI_EXPORT QPlatformFontDatabase
|
||||
public:
|
||||
virtual ~QPlatformFontDatabase();
|
||||
virtual void populateFontDatabase();
|
||||
virtual bool populateFamilyAliases() { return false; }
|
||||
virtual bool populateFamilyAliases(const QString &missingFamily) { Q_UNUSED(missingFamily); return false; }
|
||||
virtual void populateFamily(const QString &familyName);
|
||||
virtual void invalidate();
|
||||
|
||||
|
@ -48,6 +48,8 @@
|
||||
#import <UIKit/UIFont.h>
|
||||
#endif
|
||||
|
||||
#include <QtCore/qelapsedtimer.h>
|
||||
|
||||
#include "qcoretextfontdatabase_p.h"
|
||||
#include "qfontengine_coretext_p.h"
|
||||
#if QT_CONFIG(settings)
|
||||
@ -113,39 +115,77 @@ QCoreTextFontDatabase::~QCoreTextFontDatabase()
|
||||
|
||||
void QCoreTextFontDatabase::populateFontDatabase()
|
||||
{
|
||||
qCDebug(lcQpaFonts) << "Populating font database...";
|
||||
QElapsedTimer elapsed;
|
||||
if (lcQpaFonts().isDebugEnabled())
|
||||
elapsed.start();
|
||||
|
||||
QCFType<CFArrayRef> familyNames = CTFontManagerCopyAvailableFontFamilyNames();
|
||||
for (NSString *familyName in familyNames.as<const NSArray *>())
|
||||
QPlatformFontDatabase::registerFontFamily(QString::fromNSString(familyName));
|
||||
|
||||
qCDebug(lcQpaFonts) << "Populating available families took" << elapsed.restart() << "ms";
|
||||
|
||||
// Force creating the theme fonts to get the descriptors in m_systemFontDescriptors
|
||||
if (m_themeFonts.isEmpty())
|
||||
(void)themeFonts();
|
||||
|
||||
qCDebug(lcQpaFonts) << "Resolving theme fonts took" << elapsed.restart() << "ms";
|
||||
|
||||
Q_FOREACH (CTFontDescriptorRef fontDesc, m_systemFontDescriptors)
|
||||
populateFromDescriptor(fontDesc);
|
||||
|
||||
qCDebug(lcQpaFonts) << "Populating system descriptors took" << elapsed.restart() << "ms";
|
||||
|
||||
Q_ASSERT(!m_hasPopulatedAliases);
|
||||
}
|
||||
|
||||
bool QCoreTextFontDatabase::populateFamilyAliases()
|
||||
bool QCoreTextFontDatabase::populateFamilyAliases(const QString &missingFamily)
|
||||
{
|
||||
#if defined(Q_OS_MACOS)
|
||||
if (m_hasPopulatedAliases)
|
||||
return false;
|
||||
|
||||
// There's no API to go from a localized family name to its non-localized
|
||||
// name, so we have to resort to enumerating all the available fonts and
|
||||
// doing a reverse lookup.
|
||||
|
||||
qCDebug(lcQpaFonts) << "Populating family aliases...";
|
||||
QElapsedTimer elapsed;
|
||||
elapsed.start();
|
||||
|
||||
QString nonLocalizedMatch;
|
||||
QCFType<CFArrayRef> familyNames = CTFontManagerCopyAvailableFontFamilyNames();
|
||||
NSFontManager *fontManager = NSFontManager.sharedFontManager;
|
||||
for (NSString *familyName in familyNames.as<const NSArray *>()) {
|
||||
NSFontManager *fontManager = [NSFontManager sharedFontManager];
|
||||
NSString *localizedFamilyName = [fontManager localizedNameForFamily:familyName face:nil];
|
||||
if (![localizedFamilyName isEqual:familyName]) {
|
||||
QPlatformFontDatabase::registerAliasToFontFamily(
|
||||
QString::fromNSString(familyName),
|
||||
QString::fromNSString(localizedFamilyName));
|
||||
QString nonLocalizedFamily = QString::fromNSString(familyName);
|
||||
QString localizedFamily = QString::fromNSString(localizedFamilyName);
|
||||
QPlatformFontDatabase::registerAliasToFontFamily(nonLocalizedFamily, localizedFamily);
|
||||
if (localizedFamily == missingFamily)
|
||||
nonLocalizedMatch = nonLocalizedFamily;
|
||||
}
|
||||
}
|
||||
m_hasPopulatedAliases = true;
|
||||
|
||||
if (lcQpaFonts().isWarningEnabled()) {
|
||||
QString warningMessage;
|
||||
QDebug msg(&warningMessage);
|
||||
|
||||
msg << "Populating font family aliases took" << elapsed.restart() << "ms.";
|
||||
if (!nonLocalizedMatch.isNull())
|
||||
msg << "Replace uses of" << missingFamily << "with its non-localized name" << nonLocalizedMatch;
|
||||
else
|
||||
msg << "Replace uses of missing font family" << missingFamily << "with one that exists";
|
||||
msg << "to avoid this cost.";
|
||||
|
||||
qCWarning(lcQpaFonts) << qPrintable(warningMessage);
|
||||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
Q_UNUSED(missingFamily);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
QCoreTextFontDatabase();
|
||||
~QCoreTextFontDatabase();
|
||||
void populateFontDatabase() override;
|
||||
bool populateFamilyAliases() override;
|
||||
bool populateFamilyAliases(const QString &missingFamily) override;
|
||||
void populateFamily(const QString &familyName) override;
|
||||
void invalidate() override;
|
||||
|
||||
|
@ -214,7 +214,7 @@ static QString strippedText(QString s)
|
||||
NSString *filepath = info.filePath().toNSString();
|
||||
NSURL *url = [NSURL fileURLWithPath:filepath isDirectory:info.isDir()];
|
||||
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||
|| [self panel:nil shouldEnableURL:url];
|
||||
|| [self panel:mOpenPanel shouldEnableURL:url];
|
||||
|
||||
[self updateProperties];
|
||||
[mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""];
|
||||
@ -233,7 +233,7 @@ static QString strippedText(QString s)
|
||||
NSString *filepath = info.filePath().toNSString();
|
||||
NSURL *url = [NSURL fileURLWithPath:filepath isDirectory:info.isDir()];
|
||||
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||
|| [self panel:nil shouldEnableURL:url];
|
||||
|| [self panel:mSavePanel shouldEnableURL:url];
|
||||
|
||||
[mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]];
|
||||
[mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""];
|
||||
@ -263,7 +263,7 @@ static QString strippedText(QString s)
|
||||
NSString *filepath = info.filePath().toNSString();
|
||||
NSURL *url = [NSURL fileURLWithPath:filepath isDirectory:info.isDir()];
|
||||
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|
||||
|| [self panel:nil shouldEnableURL:url];
|
||||
|| [self panel:mSavePanel shouldEnableURL:url];
|
||||
|
||||
[self updateProperties];
|
||||
[mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]];
|
||||
|
@ -3462,6 +3462,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
|
||||
{
|
||||
Q_D(const QMacStyle);
|
||||
const AppearanceSync sync;
|
||||
const QMacAutoReleasePool pool;
|
||||
QMacCGContext cg(p);
|
||||
QWindow *window = w && w->window() ? w->window()->windowHandle() : nullptr;
|
||||
d->resolveCurrentNSView(window);
|
||||
@ -4326,7 +4327,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
|
||||
break;
|
||||
case CE_ProgressBarContents:
|
||||
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
|
||||
QMacAutoReleasePool pool;
|
||||
const bool isIndeterminate = (pb->minimum == 0 && pb->maximum == 0);
|
||||
const bool vertical = pb->orientation == Qt::Vertical;
|
||||
const bool inverted = pb->invertedAppearance;
|
||||
|
@ -0,0 +1,3 @@
|
||||
QT += widgets
|
||||
SOURCES += main.cpp
|
||||
LIBS += -fsanitize=fuzzer
|
36
tests/libfuzzer/gui/text/qtextlayout/beginLayout/main.cpp
Normal file
36
tests/libfuzzer/gui/text/qtextlayout/beginLayout/main.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QTextLayout>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
|
||||
QTextLayout tl(QByteArray::fromRawData(Data, Size));
|
||||
tl.beginLayout();
|
||||
tl.endLayout();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user