From f71048a5314c93732a8a77460b465709b632ff5e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 22 Aug 2018 13:02:04 +0200 Subject: [PATCH 01/17] Fix crash when combining QOpenGLWidget, QStaticText and Qt Quick Under certain circumstances, if you had a widget with a QOpenGLPaintEngine, and drew QStaticText into this, and then later had Qt Quick access the same cache and try to resize it, we would get a crash because the resize function would have a pointer to the paint engine and try to access its shader manager (which would now be null, since this is outside the begin()/end() phase of the paint engine. The solution is to reset the paint engine pointer to null on the cache once it has been populated and it is no longer needed. [ChangeLog][QtGui][Text] Fixed a possible crash when combining QStaticText, QOpenGLWidget and Qt Quick in the same application. Task-number: QTBUG-70096 Change-Id: I7383ad7456d1a72499cfcd2da09a5a808d4b3eff Reviewed-by: Simon Hausmann --- src/gui/opengl/qopenglpaintengine.cpp | 1 + src/gui/opengl/qopengltextureglyphcache_p.h | 5 ++ .../qopenglwidget/tst_qopenglwidget.cpp | 54 +++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 3d1c362275..6a89089f18 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -1741,6 +1741,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly // we may have to re-bind brush textures after filling in the cache. brushTextureDirty = (QT_BRUSH_TEXTURE_UNIT == glypchCacheTextureUnit); } + cache->setPaintEnginePrivate(nullptr); } if (cache->width() == 0 || cache->height() == 0) diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h index 0b7b5f6082..598cb00ee5 100644 --- a/src/gui/opengl/qopengltextureglyphcache_p.h +++ b/src/gui/opengl/qopengltextureglyphcache_p.h @@ -152,6 +152,11 @@ public: void clear(); + QOpenGL2PaintEngineExPrivate *paintEnginePrivate() const + { + return pex; + } + private: void setupVertexAttribs(); diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp index db125f6644..21c9f41646 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp +++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,8 @@ #include #include #include +#include +#include #include class tst_QOpenGLWidget : public QObject @@ -64,6 +67,10 @@ private slots: void stackWidgetOpaqueChildIsVisible(); void offscreen(); void offscreenThenOnscreen(); + +#ifdef QT_BUILD_INTERNAL + void staticTextDanglingPointer(); +#endif }; void tst_QOpenGLWidget::initTestCase() @@ -675,6 +682,53 @@ void tst_QOpenGLWidget::offscreenThenOnscreen() QVERIFY(image.pixel(30, 40) == qRgb(0, 0, 255)); } +class StaticTextPainterWidget : public QOpenGLWidget +{ +public: + StaticTextPainterWidget(QWidget *parent = nullptr) + : QOpenGLWidget(parent) + { + } + + void paintEvent(QPaintEvent *) + { + QPainter p(this); + text.setText(QStringLiteral("test")); + p.drawStaticText(0, 0, text); + + ctx = QOpenGLContext::currentContext(); + } + + QStaticText text; + QOpenGLContext *ctx; +}; + +#ifdef QT_BUILD_INTERNAL +void tst_QOpenGLWidget::staticTextDanglingPointer() +{ + QWidget w; + StaticTextPainterWidget *glw = new StaticTextPainterWidget(&w); + w.resize(640, 480); + glw->resize(320, 200); + w.show(); + + QVERIFY(QTest::qWaitForWindowExposed(&w)); + QStaticTextPrivate *d = QStaticTextPrivate::get(&glw->text); + + QCOMPARE(d->itemCount, 1); + QFontEngine *fe = d->items->fontEngine(); + + for (int i = QFontEngine::Format_None; i <= QFontEngine::Format_ARGB; ++i) { + QOpenGLTextureGlyphCache *cache = + (QOpenGLTextureGlyphCache *) fe->glyphCache(glw->ctx, + QFontEngine::GlyphFormat(i), + QTransform()); + if (cache != nullptr) + QCOMPARE(cache->paintEnginePrivate(), nullptr); + } +} +#endif + QTEST_MAIN(tst_QOpenGLWidget) #include "tst_qopenglwidget.moc" From 9652711a0781a652fbf2319b0c59121c381bf016 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Mon, 27 Aug 2018 14:11:39 +0200 Subject: [PATCH 02/17] Doc: Remove non-reentrant from QDomDocument::setContent Following QTBUG-40015, QDomDocument::setContent is reentrant. This change updates the documentation accordingly. Fixes: QTBUG-69920 Change-Id: Id09e3541156f52d1a976afd02b410c263d3b3352 Reviewed-by: David Faure --- src/xml/dom/qdom.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 17f87804e9..91796106a2 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -6666,8 +6666,6 @@ bool QDomDocument::setContent(const QString& text, bool namespaceProcessing, QSt } /*! - \nonreentrant - This function parses the XML document from the byte array \a data and sets it as the content of the document. It tries to detect the encoding of the document as required by the XML From ac5e617596625504f4bd5d8bdb8cabb51b575a87 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Mon, 27 Aug 2018 13:03:26 +0200 Subject: [PATCH 03/17] Doc: Fix typos in QRectF documentation Add missing 's'. Fixes: QTWEBSITE-823 Change-Id: I1acd3b7ae18982248bf3402fa5943ee95c1efdbe Reviewed-by: Venugopal Shivashankar --- src/corelib/tools/qrect.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index 40d6c8b7c3..ad1885e8ce 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE The QRect class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of - these. QRect also provide functions to move the rectangle relative + these. QRect also provides functions to move the rectangle relative to the various coordinates. In addition there is a moveTo() function that moves the rectangle, leaving its top left corner at the given coordinates. Alternatively, the translate() function @@ -155,7 +155,7 @@ QT_BEGIN_NAMESPACE The QRect class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of - these. QRect also provide functions to move the rectangle relative + these. QRect also provides functions to move the rectangle relative to the various coordinates. For example the left(), setLeft() and moveLeft() functions as an @@ -1335,7 +1335,7 @@ QDebug operator<<(QDebug dbg, const QRect &r) The QRectF class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of - these. QRectF also provide functions to move the rectangle + these. QRectF also provides functions to move the rectangle relative to the various coordinates. In addition there is a moveTo() function that moves the rectangle, leaving its top left corner at the given coordinates. Alternatively, the translate() @@ -1418,7 +1418,7 @@ QDebug operator<<(QDebug dbg, const QRect &r) The QRectF class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of - these. QRectF also provide functions to move the rectangle + these. QRectF also provides functions to move the rectangle relative to the various coordinates. For example: the bottom(), setBottom() and moveBottom() functions: From 2ef53620115037015d44d9629ee1e12da44be715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 18 Jul 2018 23:51:58 +0200 Subject: [PATCH 04/17] QMacStyle: Make helper-NSViews layer-backed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents the view from triggering display of its superview when being temporarily added, which is both inefficient and causes issues when those dirty-rects are wrong due to the wrong frame position of the added view. The additional drawRect: calls and corresponding expose events resulting from the needsDisplay calls also caused repaint issues in Qt Widgets. QWidgetBackingStore doesn't seem to take the exposed region into account for an expose event, and will try to flush all dirty regions. Some of those may be outside the exposed region, and will be clipped away by the window system, never ending up on the screen, but with Widgets still thinking it has flushed all dirty regions. This is a separate issue, possibly solvable by setting the wantsDefaultClipping property on NSView to NO, but this needs further testing, so applying this commit as workaround makes sense, even if it's just hiding the real bug. Task-number: QTBUG-67998 Task-number: QTBUG-68023 Task-number: QTBUG-69990 Task-number: QTBUG-69740 Task-number: QTBUG-69292 Task-number: QTBUG-69332 Reviewed-by: Timur Pocheptsov (cherry picked from commit 38979332d0a66666ebd178bccd7e7a2b300a7e42) Change-Id: I4ef3fef29f749daa4f3a11fe9186ae77b359f966 Reviewed-by: Simon Hausmann Reviewed-by: Morten Johan Sørvig --- src/plugins/styles/mac/qmacstyle_mac.mm | 36 +++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 45da5fbd84..3405f01046 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -1880,20 +1880,46 @@ NSCell *QMacStylePrivate::cocoaCell(CocoaControl widget) const return cell; } -void QMacStylePrivate::drawNSViewInRect(NSView *view, const QRectF &qtRect, QPainter *p, +void QMacStylePrivate::drawNSViewInRect(NSView *view, const QRectF &rect, QPainter *p, __attribute__((noescape)) DrawRectBlock drawRectBlock) const { QMacCGContext ctx(p); setupNSGraphicsContext(ctx, YES); - const CGRect rect = qtRect.toCGRect(); + // FIXME: The rect that we get in is relative to the widget that we're drawing + // style on behalf of, and doesn't take into account the offset of that widget + // to the widget that owns the backingstore, which we are placing the native + // view into below. This means most of the views are placed in the upper left + // corner of backingStoreNSView, which does not map to where the actual widget + // is, and which may cause problems such as triggering a setNeedsDisplay of the + // backingStoreNSView for the wrong rect. We work around this by making the view + // layer-backed, which prevents triggering display of the backingStoreNSView, but + // but there may be other issues lurking here due to the wrong position. QTBUG-68023 + view.wantsLayer = YES; + + // FIXME: We are also setting the frame of the incoming view a lot at the call + // sites of this function, making it unclear who's actually responsible for + // maintaining the size and position of the view. In theory the call sites + // should ensure the _size_ of the view is correct, and then let this code + // take care of _positioning_ the view at the right place inside backingStoreNSView. + // For now we pass on the rect as is, to prevent any regressions until this + // can be investigated properly. + view.frame = rect.toCGRect(); [backingStoreNSView addSubview:view]; - view.frame = rect; + + // FIXME: Based on the code below, this method isn't drawing an NSView into + // a rect, it's drawing _part of the NSView_, defined by the incoming clip + // or dirty rect, into the current graphics context. We're doing some manual + // translations at the call sites that would indicate that this relationship + // is a bit fuzzy. + const CGRect dirtyRect = rect.toCGRect(); + if (drawRectBlock) - drawRectBlock(ctx, rect); + drawRectBlock(ctx, dirtyRect); else - [view drawRect:rect]; + [view drawRect:dirtyRect]; + [view removeFromSuperviewWithoutNeedingDisplay]; restoreNSGraphicsContext(ctx); From 5b6eb8e247d246a28bdc8ce533c52d7647a44a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 28 Aug 2018 14:42:26 +0200 Subject: [PATCH 05/17] Extend C++1z test to include variant APIs we use std::get and std::visit are only available on macOS 10.14, so as long as we're building with a deployment target lower than that, we can't enable C++1z globally unless we special-case use of those functions. Change-Id: Idb5eb5992ea4dd7eab92f5310321720e19ac793e Reviewed-by: Ville Voutilainen Reviewed-by: Simon Hausmann --- configure.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.json b/configure.json index 07514992d1..2dc79137e8 100644 --- a/configure.json +++ b/configure.json @@ -283,7 +283,13 @@ "#else", "# error __cplusplus must be > 201402L (the value for C++14)", "#endif", - "#include // https://bugs.llvm.org//show_bug.cgi?id=33117" + "#include // https://bugs.llvm.org//show_bug.cgi?id=33117", + "#include " + ], + "main": [ + "std::variant v(42);", + "int i = std::get(v);", + "std::visit([](const auto &) { return 1; }, v);" ], "qmake": "CONFIG += c++11 c++14 c++1z" } From 3ed306772eb333fb4d9fa0b0a003c119e848ed58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 31 Aug 2018 11:43:24 +0200 Subject: [PATCH 06/17] macOS: Detect changes to the platform SDK and ask the user to deal with it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise the SDK upgrade (or downgrade) may subtly and silently affect the resulting binary, or if it results in build breaks, the user won't know why. We limit it to applications for now, as that's the point where it's most important to catch the SDK upgrade, but technically we should also do this for intermediate libraries. Doing it for everything will likely incur a performance cost, so we skip that for now. Change-Id: I8a0604aad8b1e9fba99848ab8ab031c07fd50dc4 Reviewed-by: Morten Johan Sørvig --- mkspecs/features/mac/default_post.prf | 6 ++++++ mkspecs/features/mac/sdk.mk | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 mkspecs/features/mac/sdk.mk diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index c6eb7c5a2c..adc796f395 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -1,5 +1,11 @@ load(default_post) +# Detect changes to the platform SDK. Apps only for now +contains(TEMPLATE, .*app):!macx-xcode { + QMAKE_EXTRA_VARIABLES += QMAKE_MAC_SDK QMAKE_MAC_SDK_VERSION + QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk) +} + !no_objective_c:CONFIG += objective_c qt { diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk new file mode 100644 index 0000000000..a7c8268da5 --- /dev/null +++ b/mkspecs/features/mac/sdk.mk @@ -0,0 +1,12 @@ +CURRENT_MAC_SDK_VERSION := $(shell /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version) + +ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION)) + $(info The platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).) + $(info This requires a fresh build. Please wipe the build directory completely,) + $(info including any .qmake.stash and .qmake.cache files generated by qmake.) + # FIXME: Ideally this should be advertised as just running make distclean, or we + # should even do it automatically by having proper makefile dependencies between + # .qmake.stash and the SDK version, but as qmake doesn't seem to be consistent in + # how it deals with .qmake.stash as a dependency we need to defer that until later. + $(error ^) +endif From 4e4057460a0b27e4a8eff749fb284f61f245982e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 31 Aug 2018 12:33:08 +0200 Subject: [PATCH 07/17] macOS: Warn the user when using incompatible or untested platform SDKs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-70263 Change-Id: Ic946d1efc69ebb8ba65bbba956ed55ab7183957e Reviewed-by: Morten Johan Sørvig --- configure.pri | 2 ++ mkspecs/common/macx.conf | 2 ++ mkspecs/features/mac/default_post.prf | 40 ++++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/configure.pri b/configure.pri index 34d7c8cf42..6e7f6b76a4 100644 --- a/configure.pri +++ b/configure.pri @@ -1115,6 +1115,8 @@ defineReplace(qtConfOutputPostProcess_publicPro) { "QT_GCC_MINOR_VERSION = $$QMAKE_GCC_MINOR_VERSION" \ "QT_GCC_PATCH_VERSION = $$QMAKE_GCC_PATCH_VERSION" } + !isEmpty(QMAKE_MAC_SDK_VERSION): \ + output += "QT_MAC_SDK_VERSION = $$QMAKE_MAC_SDK_VERSION" !isEmpty(QMAKE_CLANG_MAJOR_VERSION) { output += \ "QT_CLANG_MAJOR_VERSION = $$QMAKE_CLANG_MAJOR_VERSION" \ diff --git a/mkspecs/common/macx.conf b/mkspecs/common/macx.conf index 4be0eb3c39..8f9eda10d7 100644 --- a/mkspecs/common/macx.conf +++ b/mkspecs/common/macx.conf @@ -5,6 +5,8 @@ QMAKE_PLATFORM += macos osx macx QMAKE_MAC_SDK = macosx +QT_MAC_SDK_VERSION_TESTED_WITH = 10.13 + device.sdk = macosx device.target = device device.dir_affix = $${device.sdk} diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index adc796f395..353fda41e6 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -1,9 +1,41 @@ load(default_post) -# Detect changes to the platform SDK. Apps only for now -contains(TEMPLATE, .*app):!macx-xcode { - QMAKE_EXTRA_VARIABLES += QMAKE_MAC_SDK QMAKE_MAC_SDK_VERSION - QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk) +contains(TEMPLATE, .*app) { + !macx-xcode { + # Detect changes to the platform SDK + QMAKE_EXTRA_VARIABLES += QMAKE_MAC_SDK QMAKE_MAC_SDK_VERSION + QMAKE_EXTRA_INCLUDES += $$shell_quote($$PWD/sdk.mk) + } + + # Detect incompatible SDK versions + + !versionAtLeast(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION): \ + warning("Qt requires at least version $$QT_MAC_SDK_VERSION of the platform SDK," \ + "you're using $${QMAKE_MAC_SDK_VERSION}. Please upgrade.") + + !isEmpty(QT_MAC_SDK_VERSION_TESTED_WITH) { + # For Qt developers only + !isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \ + CONFIG += sdk_no_version_check + + !sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION_TESTED_WITH) { + warning("Qt has only been tested with version $$QT_MAC_SDK_VERSION_TESTED_WITH"\ + "of the platform SDK, you're using $${QMAKE_MAC_SDK_VERSION}.") + warning("This is an unsupported configuration. You may experience build issues," \ + "and by using") + warning("the $$QMAKE_MAC_SDK_VERSION SDK you are opting in to new features" \ + "that Qt has not been prepared for.") + + isEqual(QMAKE_MAC_SDK_VERSION, 10.14): \ + warning("E.g., 10.14 enables dark mode and layer-backed views," \ + "which Qt $${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION} does not support.") + + warning("Please downgrade the SDK you use to build your app to version" \ + "$$QT_MAC_SDK_VERSION_TESTED_WITH, or configure") + warning("with CONFIG+=sdk_no_version_check when running qmake" \ + "to silence this warning.") + } + } } !no_objective_c:CONFIG += objective_c From d615fb39d58d61d244a460ee13f11c73431a35e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 17 Aug 2018 09:47:59 +0200 Subject: [PATCH 08/17] Make QMacCocoaViewContainer work again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The widget visibility state was set to explicitly hidden, which was preventing it from working correctly when its parent widget was shown. This regression was introduced by commit d7a9e08, which made QWindow::setVisible() call QWidget::setVisible(). QWindow::destroy() calls QWindow::setVisible(false), which means that the destroy() call in setCocoaView() would set the CoocaViewContainer to be explicitly hidden. Clear WA_WState_Hidden to work around this behavior. Task-number: QTBUG-67504 Change-Id: I77438fcd01f165f058eea178c214838bd4f27084 Reviewed-by: Tor Arne Vestbø --- src/widgets/widgets/qmaccocoaviewcontainer_mac.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index 98ee90deb7..0b64b2a2bb 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -165,6 +165,11 @@ void QMacCocoaViewContainer::setCocoaView(NSView *view) Q_ASSERT(window->handle()); [oldView release]; + + // The QWindow::destroy()) call above will explicitly hide this widget. + // Clear the hidden state here so it can be implicitly shown again. + setAttribute(Qt::WA_WState_Hidden, false); + } QT_END_NAMESPACE From 4daa6bba7fcafd7868552a134f7a0888c9548554 Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Tue, 28 Aug 2018 11:37:34 +0300 Subject: [PATCH 09/17] Add changes file for Qt 5.11.2 Edited-by: Thiago Macieira Change-Id: Ic7f9fdb79524194bf92d330052d971506f066fc5 Reviewed-by: Kai Koehne Reviewed-by: Thiago Macieira --- dist/changes-5.11.2 | 129 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 dist/changes-5.11.2 diff --git a/dist/changes-5.11.2 b/dist/changes-5.11.2 new file mode 100644 index 0000000000..5bb61339dd --- /dev/null +++ b/dist/changes-5.11.2 @@ -0,0 +1,129 @@ +Qt 5.11.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.11.0 through 5.11.1. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.11 series is binary compatible with the 5.10.x series. +Applications compiled for 5.10 will continue to run with 5.11. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Qt 5.11.2 Changes * +**************************************************************************** + +**************************************************************************** +* Licensing * +**************************************************************************** + + - [QTBUG-52222] The commercial preview license in the git checkout has + been replaced by the Qt License Agreement 4.0 text. This makes it + explicit that commercial customers of The Qt Company can use the git + version under commercial terms. However, support is (still) only + provided for builds from released branches of Qt. + +**************************************************************************** +* QtCore * +**************************************************************************** + + - QFile: + * [QTBUG-69417] Fixed a regression in QFile::copy() that caused the + original file not to be copied entirely if it was modified outside of + this QFile object between the last time we checked its size and the + copy() call. Note this is not a prevention against race conditions. + * [QTBUG-69148] Fixed a regression that caused QFile::map() to succeed + or produce incorrect results when trying to map a file at an offset + beyond 4 GB on 32-bit Android systems and on some special Linux + configurations. + + - QObject: + * [QTBUG-69744] Fixed a bug in setProperty() that caused a property + change not to take effect if the old value compared equal using + QVariant's equality operator, but the values were not strictly equal. + + - QPluginLoader: + * Fixed an issue that could cause a crash when certain damaged or + corrupt plugin files were scanned. + + - QSortFilterProxyModel: + * [QTBUG-58499][QTBUG-69158] insertRows(row,count,parent) with row == + rowCount will insert at the bottom of the source model rather than + at the row QSortFilterProxyModel::rowCount of the source model. + + - QStorageInfo: + * [QTBUG-60215] Fixed a bug that caused the last entry in the mtab file + to be ignored on Android. + * Fixed a bug on Android that could cause QStorageInfo to skip some + filesystems (if the mount table is a virtual file and contains any + short lines) or crash (if the mount table contains any 3-field lines). + + - QString: + * [QTBUG-63620] Formatting of doubles with single-digit exponent, by + number() or args(), now includes a leading zero in that exponent, + consistently with sprintf(), as it did up to 5.6. + + - QSysInfo: + * Fixed QSysInfo::productType() to properly detect some Linux + distributions that ship with a minimal /etc. + + - QTemporaryFile: + * [QTBUG-69436] Worked around a bug in the GNU C Library versions 2.21 + and earlier (used on Linux) that caused temporary files to be created + with permissions 000. + + - QUrl: + * Fixed a bug that caused URLs whose hostnames contained unassigned or + prohibited Unicode codepoints to report isValid() == true, despite + clearing the hostname. + +**************************************************************************** +* QtGui * +**************************************************************************** + + - QMatrix: + * The qHash() implementation for QMatrix has been changed. + + - QTransform: + * The qHash() implementation for QTransform has been changed. + + - Text: + * [QTBUG-69661] Fixed potential crash when using + QTextOption::ShowLineAndParagraphSeparators. + * [QTBUG-70096] Fixed a possible crash when combining QStaticText, + QOpenGLWidget and Qt Quick in the same application. + +**************************************************************************** +* QtWidgets * +**************************************************************************** + + - QMessageBox: + * [QTBUG-69526] A message box with two buttons, one of which is the "Show + Details..." button, can now be closed by clicking the X button on the + window's title bar. + + - QFileDialog: + * QFileDialog::selectedMimeTypeFilter() now returns the actually + selected name filter. + +**************************************************************************** +* Third-Party Code * +**************************************************************************** + + - [QTBUG-69274] SQLite was updated to version 3.24.0. + - [QTBUG-69271] PCRE2 was updated to version 10.31. + +**************************************************************************** +* plugins * +**************************************************************************** + + - ibus: + * Qt programs in Flatpak environment can now trigger IBus input method. From 9da5b6f7432dc1d87cec94040ede69cb2f7ff537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 31 Aug 2018 14:02:51 +0200 Subject: [PATCH 10/17] Revert "macOS: Force light theme on macOS 10.14+" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This does not really work: as soon as you build with the 10.14 SDK you opt-in to having updated palette management, which the Qt 5.11 series does not have. This leaves app developers with two ways to opt-out of dark mode: - Build with the 10.13 (or earlier) SDK. - Set NSRequiresAquaSystemAppearance in Info.plist This reverts commit 04671a80db32bd7fce470c50934cf60f2e8ffa70. Change-Id: I5c01b9965da45de914f699526ba0723837f36e1d Reviewed-by: Tor Arne Vestbø Reviewed-by: Gabriel de Dietrich --- .../platforms/cocoa/qcocoaintegration.mm | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 79f7ebda54..55b3805df3 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -70,12 +70,6 @@ #include -#if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14) -@interface NSApplication (MojaveForwardDeclarations) -@property (strong) NSAppearance *appearance NS_AVAILABLE_MAC(10_14); -@end -#endif - static void initResources() { Q_INIT_RESOURCE(qcocoaresources); @@ -137,21 +131,6 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList) NSApplication *cocoaApplication = [QNSApplication sharedApplication]; qt_redirectNSApplicationSendEvent(); - if (__builtin_available(macOS 10.14, *)) { - // Disable dark appearance, unless the Info.plist or environment requests that it should be enabled - bool plistEnablesDarkAppearance = [[[NSBundle mainBundle] objectForInfoDictionaryKey: - @"NSRequiresAquaSystemAppearance"] boolValue]; - - bool hasEnvironmentRequiresAquaAppearance; - int environmentRequiresAquaAppearance = qEnvironmentVariableIntValue( - "QT_MAC_REQUIRES_AQUA_SYSTEM_APPEARANCE", &hasEnvironmentRequiresAquaAppearance); - bool environmentEnablesDarkAppearance = hasEnvironmentRequiresAquaAppearance - && environmentRequiresAquaAppearance == 0; - - if (!(plistEnablesDarkAppearance || environmentEnablesDarkAppearance)) - NSApp.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; - } - if (qEnvironmentVariableIsEmpty("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM")) { // Applications launched from plain executables (without an app // bundle) are "background" applications that does not take keybaord From c0e94fa0cd2a2e6216dae5da0dde289fb689d22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 5 Sep 2018 12:18:59 +0200 Subject: [PATCH 11/17] macOS: Use NSOpenGLContext's drawable directly to track active drawable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't need a separate QWindow pointer to keep track of the active window, it's recorded already by the NSOpenGLContext's drawable. And we don't need to juggle the drawable when the window is hidden, the drawable is still valid after the window is re-shown, and we call update on every frame (for now) anyways, which will reconfigure the drawable if needed. Change-Id: I199b6c027226dd239c13ecc4aba86986ca09a1eb Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 3 -- .../platforms/cocoa/qcocoaglcontext.mm | 35 +++---------------- .../platforms/cocoa/qcocoanativeinterface.mm | 4 --- src/plugins/platforms/cocoa/qcocoawindow.h | 8 ----- src/plugins/platforms/cocoa/qcocoawindow.mm | 19 ---------- 5 files changed, 5 insertions(+), 64 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index 9d827289f7..cef5892989 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -65,8 +65,6 @@ public: bool isSharing() const override; bool isValid() const override; - void windowWasHidden(); - NSOpenGLContext *nativeContext() const; QFunctionPointer getProcAddress(const char *procName) override; @@ -80,7 +78,6 @@ private: NSOpenGLContext *m_context = nil; NSOpenGLContext *m_shareContext = nil; QSurfaceFormat m_format; - QPointer m_currentWindow; bool m_didCheckForSoftwareContext = false; }; diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index cf4ecd335c..c90f093836 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -318,9 +318,6 @@ void QCocoaGLContext::updateSurfaceFormat() QCocoaGLContext::~QCocoaGLContext() { - if (m_currentWindow && m_currentWindow.data()->handle()) - static_cast(m_currentWindow.data()->handle())->setCurrentContext(0); - [m_context release]; } @@ -372,20 +369,15 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface) // on the previously set drawable. qCDebug(lcQpaOpenGLContext) << "Clearing current drawable" << m_context.view << "for" << m_context; [m_context clearDrawable]; - m_currentWindow.clear(); return true; } Q_ASSERT(surface->surface()->surfaceClass() == QSurface::Window); - QWindow *window = static_cast(surface)->window(); + QNSView *view = qnsview_cast(static_cast(surface)->view()); - if (window == m_currentWindow.data()) + if (view == m_context.view) return true; - Q_ASSERT(window->handle()); - QCocoaWindow *cocoaWindow = static_cast(window->handle()); - NSView *view = cocoaWindow->view(); - if ((m_context.view = view) != view) { qCInfo(lcQpaOpenGLContext) << "Failed to set" << view << "as drawable for" << m_context; return false; @@ -393,12 +385,6 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface) qCInfo(lcQpaOpenGLContext) << "Set drawable for" << m_context << "to" << m_context.view; - if (m_currentWindow && m_currentWindow.data()->handle()) - static_cast(m_currentWindow.data()->handle())->setCurrentContext(0); - - m_currentWindow = window; - - cocoaWindow->setCurrentContext(this); return true; } @@ -435,24 +421,13 @@ void QCocoaGLContext::doneCurrent() qCDebug(lcQpaOpenGLContext) << "Clearing current context" << [NSOpenGLContext currentContext] << "in" << QThread::currentThread(); - if (m_currentWindow && m_currentWindow.data()->handle()) - static_cast(m_currentWindow.data()->handle())->setCurrentContext(nullptr); - - m_currentWindow.clear(); + // Note: We do not need to clear the current drawable here. + // As long as there is no current context, GL calls will + // do nothing. [NSOpenGLContext clearCurrentContext]; } -void QCocoaGLContext::windowWasHidden() -{ - // If the window is hidden, we need to unset the m_currentWindow - // variable so that succeeding makeCurrent's will not abort prematurely - // because of the optimization in setDrawable. - // Doing a full doneCurrent here is not preferable, because the GL context - // might be rendering in a different thread at this time. - m_currentWindow.clear(); -} - QSurfaceFormat QCocoaGLContext::format() const { return m_format; diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 228df50d86..7979e430ac 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -102,10 +102,6 @@ void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceS if (resourceString == "nsview") { return static_cast(window->handle())->m_view; -#ifndef QT_NO_OPENGL - } else if (resourceString == "nsopenglcontext") { - return static_cast(window->handle())->currentContext()->nativeContext(); -#endif } else if (resourceString == "nswindow") { return static_cast(window->handle())->nativeWindow(); #if QT_CONFIG(vulkan) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 225c7eda84..8f1bdb8af0 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -169,11 +169,6 @@ public: NSUInteger windowStyleMask(Qt::WindowFlags flags); void setWindowZoomButton(Qt::WindowFlags flags); -#ifndef QT_NO_OPENGL - void setCurrentContext(QCocoaGLContext *context); - QCocoaGLContext *currentContext() const; -#endif - bool setWindowModified(bool modified) override; void setFrameStrutEventsEnabled(bool enabled) override; @@ -253,9 +248,6 @@ public: // for QNSView bool m_inSetVisible; bool m_inSetGeometry; bool m_inSetStyleMask; -#ifndef QT_NO_OPENGL - QCocoaGLContext *m_glContext; -#endif QCocoaMenuBar *m_menubar; bool m_needsInvalidateShadow; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 2178f3bf23..1de8577ebe 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -151,9 +151,6 @@ QCocoaWindow::QCocoaWindow(QWindow *win, WId nativeHandle) , m_inSetVisible(false) , m_inSetGeometry(false) , m_inSetStyleMask(false) -#ifndef QT_NO_OPENGL - , m_glContext(nullptr) -#endif , m_menubar(nullptr) , m_needsInvalidateShadow(false) , m_hasModalSession(false) @@ -405,10 +402,6 @@ void QCocoaWindow::setVisible(bool visible) [m_view setHidden:NO]; } else { // qDebug() << "close" << this; -#ifndef QT_NO_OPENGL - if (m_glContext) - m_glContext->windowWasHidden(); -#endif QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast(QGuiApplication::instance()->eventDispatcher()); QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = nullptr; if (cocoaEventDispatcher) @@ -1336,18 +1329,6 @@ bool QCocoaWindow::windowIsPopupType(Qt::WindowType type) const return ((type & Qt::Popup) == Qt::Popup); } -#ifndef QT_NO_OPENGL -void QCocoaWindow::setCurrentContext(QCocoaGLContext *context) -{ - m_glContext = context; -} - -QCocoaGLContext *QCocoaWindow::currentContext() const -{ - return m_glContext; -} -#endif - /*! Checks if the window is the content view of its immediate NSWindow. From b66357e3ebf3e3dbda04f880e87184e247882843 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 5 Sep 2018 10:01:00 -0700 Subject: [PATCH 12/17] moc: Fix compilation of text strings containing non-ASCII On platforms where char is signed, like x86, the following is an error (narrowing conversion): unsigned char x[] = { '\xc3' }; Change-Id: I495bc19409f348069f5bfffd15518f9ef4e43faf Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Thiago Macieira --- src/tools/moc/cbordevice.h | 4 +++- .../plugin/qpluginloader/theplugin/theplugin.h | 2 +- .../plugin/qpluginloader/tst_qpluginloader.cpp | 8 ++++++++ .../corelib/plugin/qpluginloader/utf8_data.json | 17 +++++++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/auto/corelib/plugin/qpluginloader/utf8_data.json diff --git a/src/tools/moc/cbordevice.h b/src/tools/moc/cbordevice.h index 25b75b79eb..dbfc537dd2 100644 --- a/src/tools/moc/cbordevice.h +++ b/src/tools/moc/cbordevice.h @@ -82,8 +82,10 @@ private: void putChar(char c) { putNewline(); - if (c < 0x20 || c >= 0x7f) + if (uchar(c) < 0x20) fprintf(out, " '\\x%x',", uint8_t(c)); + else if (uchar(c) >= 0x7f) + fprintf(out, " uchar('\\x%x'),", uint8_t(c)); else if (c == '\'' || c == '\\') fprintf(out, " '\\%c',", c); else diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h index 04ce042e24..ac349c2f75 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h @@ -35,7 +35,7 @@ class ThePlugin : public QObject, public PluginInterface { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.autotests.plugininterface" FILE "../empty.json") + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.autotests.plugininterface" FILE "../utf8_data.json") Q_INTERFACES(PluginInterface) public: diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index 8e3ea91c40..c517c0809a 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -210,6 +210,14 @@ void tst_QPluginLoader::errorString() { QPluginLoader loader( sys_qualifiedLibraryName("theplugin")); //a plugin + + // Check metadata + const QJsonObject metaData = loader.metaData(); + QCOMPARE(metaData.value("IID").toString(), QStringLiteral("org.qt-project.Qt.autotests.plugininterface")); + const QJsonObject kpluginObject = metaData.value("MetaData").toObject().value("KPlugin").toObject(); + QCOMPARE(kpluginObject.value("Name[mr]").toString(), QString::fromUtf8("चौकट भूमिती")); + + // Load QCOMPARE(loader.load(), true); QCOMPARE(loader.errorString(), unknown); diff --git a/tests/auto/corelib/plugin/qpluginloader/utf8_data.json b/tests/auto/corelib/plugin/qpluginloader/utf8_data.json new file mode 100644 index 0000000000..7763b65178 --- /dev/null +++ b/tests/auto/corelib/plugin/qpluginloader/utf8_data.json @@ -0,0 +1,17 @@ +{ + "KPlugin": { + "Name": "WindowGeometry", + "Name[mr]": "चौकट भूमिती", + "Name[pa]": "ਵਿੰਡੋਜੁਮੈਟਰੀ", + "Name[th]": "มิติขนาดของหน้าต่าง", + "Name[uk]": "Розміри вікна", + "Name[zh_CN]": "窗口形状", + "Name[zh_TW]": "視窗位置", + "ServiceTypes": [ + "KCModule" + ] + }, + "X-KDE-ParentComponents": [ + "windowgeometry" + ] +} From 33b79ddc805b41ca4aad47be821508543721f534 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 7 Sep 2018 12:19:55 +0200 Subject: [PATCH 13/17] QDtls and QDtlsClientVerifier - add destructors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While these destructors are essentially trivial and contain no code, the classes inherit QObject and thus have virtual tables. For such classes -Wweak-vtable generates a warning: "'Class' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit." Noticed this after updating QtCreator to the latest version. Change-Id: Iacb5d0cd49353bd35260aff736652542bb1ef197 Reviewed-by: Mårten Nordheim --- src/network/ssl/qdtls.cpp | 14 ++++++++++++++ src/network/ssl/qdtls.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/network/ssl/qdtls.cpp b/src/network/ssl/qdtls.cpp index da37951de2..bbb22aa527 100644 --- a/src/network/ssl/qdtls.cpp +++ b/src/network/ssl/qdtls.cpp @@ -453,6 +453,13 @@ QDtlsClientVerifier::QDtlsClientVerifier(QObject *parent) d->setConfiguration(conf); } +/*! + Destroys the QDtlsClientVerifier object. +*/ +QDtlsClientVerifier::~QDtlsClientVerifier() +{ +} + /*! Sets the secret and the cryptographic hash algorithm from \a params. This QDtlsClientVerifier will use these to generate cookies. If the new secret @@ -576,6 +583,13 @@ QDtls::QDtls(QSslSocket::SslMode mode, QObject *parent) setDtlsConfiguration(QSslConfiguration::defaultDtlsConfiguration()); } +/*! + Destroys the QDtls object. +*/ +QDtls::~QDtls() +{ +} + /*! Sets the peer's address, \a port, and host name and returns \c true if successful. \a address must not be null, multicast, or broadcast. diff --git a/src/network/ssl/qdtls.h b/src/network/ssl/qdtls.h index 9288fd3440..8505b00d5e 100644 --- a/src/network/ssl/qdtls.h +++ b/src/network/ssl/qdtls.h @@ -78,6 +78,7 @@ class Q_NETWORK_EXPORT QDtlsClientVerifier : public QObject public: explicit QDtlsClientVerifier(QObject *parent = nullptr); + ~QDtlsClientVerifier(); struct Q_NETWORK_EXPORT GeneratorParameters { @@ -125,6 +126,7 @@ public: }; explicit QDtls(QSslSocket::SslMode mode, QObject *parent = nullptr); + ~QDtls(); bool setPeer(const QHostAddress &address, quint16 port, const QString &verificationName = {}); From 1398f4f828d70971964bf016d8b642d84af1a8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 5 Sep 2018 18:51:29 +0200 Subject: [PATCH 14/17] macOS: Release surfaces straight away when reconfiguring QCocoaGLContext MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calling setView or update on NSOpenGLContext results in recreating the internal GL surfaces of the view. Unfortunately there seems to be a fixed amount of these surfaces available, so if we spin a loop where we for some reason end up recreating them, we'll easily run out, and lock up the whole window system: thread #6, name = 'SwapThread' frame #0: 0x00007fff7b45220a libsystem_kernel.dylib`mach_msg_trap + 10 frame #1: 0x00007fff7b451724 libsystem_kernel.dylib`mach_msg + 60 frame #2: 0x00007fff751c1675 SkyLight`SLSBindSurface + 247 frame #3: 0x00007fff5d9c4328 OpenGL`___lldb_unnamed_symbol29$$OpenGL + 255 frame #4: 0x00007fff6bf42c33 libGPUSupportMercury.dylib`gldAttachDrawable + 364 frame #5: 0x00007fff5d9e61e7 GLEngine`gliAttachDrawableWithOptions + 257 frame #6: 0x00007fff5d9c4bb0 OpenGL`___lldb_unnamed_symbol38$$OpenGL + 969 frame #7: 0x00007fff5d9c8b0e OpenGL`___lldb_unnamed_symbol57$$OpenGL + 82 frame #8: 0x00007fff5d9c8e55 OpenGL`CGLSetSurface + 330 frame #9: 0x00007fff50d0eb2c AppKit`NSOpenGLContextAttachOffScreenViewSurface + 352 This can happen e.g. when resizing the application, where AppKit itself spins a loop where we don't end up back in QCocoaEventDispatcher::processEvents() for each pass (where we do have a local pool). Or it can happen in the render-loop of a render-thread that doesn't use the event dispatcher. Change-Id: Iaf2f879dd01e3d807d0f35705ccc978dbc89036b Reviewed-by: Morten Johan Sørvig Reviewed-by: Simon Hausmann --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index c90f093836..f11016679a 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -363,6 +363,11 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface) */ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface) { + // Make sure any surfaces released during this process are deallocated + // straight away, otherwise we may run out of surfaces when spinning a + // render-loop that doesn't return to one of the outer pools. + QMacAutoReleasePool pool; + if (!surface || surface->surface()->surfaceClass() == QSurface::Offscreen) { // Clear the current drawable and reset the active window, so that GL // commands that don't target a specific FBO will not end up stomping @@ -393,6 +398,11 @@ static QMutex s_contextMutex; void QCocoaGLContext::update() { + // Make sure any surfaces released during this process are deallocated + // straight away, otherwise we may run out of surfaces when spinning a + // render-loop that doesn't return to one of the outer pools. + QMacAutoReleasePool pool; + QMutexLocker locker(&s_contextMutex); qCInfo(lcQpaOpenGLContext) << "Updating" << m_context << "for" << m_context.view; [m_context update]; From b13e3b0eb69a86558a62f2544a271434818c012d Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Fri, 7 Sep 2018 13:48:44 +0200 Subject: [PATCH 15/17] Example: Close popup on mouse click without assigning new lens position Clicking in the main renderer window passes a new position to the lens, disregarding the "What's This" (documentation) overlay window. This change checks if the documentation window is open on click, and if it is, closes the documentation window and returns without further handling of the mouse event. Fixes: QTBUG-7205 Change-Id: I821245ec6c78be00d80af461baf8e4d59e0f351f Reviewed-by: Simon Hausmann --- examples/widgets/painting/deform/pathdeform.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/widgets/painting/deform/pathdeform.cpp b/examples/widgets/painting/deform/pathdeform.cpp index cfbbdb7e8e..805804716f 100644 --- a/examples/widgets/painting/deform/pathdeform.cpp +++ b/examples/widgets/painting/deform/pathdeform.cpp @@ -483,6 +483,10 @@ void PathDeformRenderer::timerEvent(QTimerEvent *e) void PathDeformRenderer::mousePressEvent(QMouseEvent *e) { + if (m_show_doc) { + setDescriptionEnabled(false); + return; + } setDescriptionEnabled(false); m_repaintTimer.stop(); From 5175824f151f6e1fee6eb7aaf5ac30e1a5654513 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 7 Sep 2018 23:31:51 +0200 Subject: [PATCH 16/17] QStringList: restore binary compatibility with Qt 5.11 Commit 8b6100d512 removed bool QtPrivate::QStringList_contains(const QStringList *that, const QString &str, ...) (in favor of a QStringView overload). However this was used inline in qstringlist.h, so apps were referencing that symbol directly. As a result, upgrading to Qt 5.12 gave errors like libKF5ConfigCore.so.5.50.0: undefined reference to `QtPrivate::QStringList_contains(QStringList const*, QString const&, Qt::CaseSensitivity)@Qt_5' collect2: error: ld returned 1 exit status Change-Id: I862263a9b06157052df894a201dfd86df8c3f4fe Reviewed-by: Thiago Macieira Reviewed-by: Luca Beldi --- src/corelib/tools/qstringlist.cpp | 9 +++++++++ src/corelib/tools/qstringlist.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index c85a4f41dd..cf150c2a1b 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -335,6 +335,15 @@ static bool stringList_contains(const QStringList &stringList, const T &str, Qt: */ #endif +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +/// Not really needed anymore, but kept for binary compatibility +bool QtPrivate::QStringList_contains(const QStringList *that, const QString &str, + Qt::CaseSensitivity cs) +{ + return stringList_contains(*that, str, cs); +} +#endif + /*! \fn bool QStringList::contains(QStringView str, Qt::CaseSensitivity cs) const \overload diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index b04b7c0bc8..10cbad04d6 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -164,6 +164,9 @@ namespace QtPrivate { QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QString &str, Qt::CaseSensitivity cs); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, const QString &str, Qt::CaseSensitivity cs); +#endif bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, QStringView str, Qt::CaseSensitivity cs); bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, QLatin1String str, Qt::CaseSensitivity cs); void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QString &before, const QString &after, From 405e297756240b5f14e44b5fbd6a88091d2eddeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 6 Sep 2018 12:36:22 +0200 Subject: [PATCH 17/17] macOS: Use dark gradients for title and status bar in dark mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These were hardcoded to light colors, which made the QMainWindow status bar look out of place and made the (light) text hard to read. Hardcode to dark colors for DarkAqua which more or less match the native look. Keep the optimization where the Gradients are stored in static variabless. Change-Id: I3e75b42c41d3e2d18e4bc0f17d950a702ccad662 Reviewed-by: Tor Arne Vestbø Reviewed-by: Gabriel de Dietrich (DO NOT ADD TO REVIEWS) --- src/plugins/styles/mac/qmacstyle_mac.mm | 56 +++++++++++++++++-------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index c70d1729c0..2a21673054 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -253,33 +253,50 @@ QVector > QMacStylePrivate::scrollBars; static QLinearGradient titlebarGradientActive() { - static QLinearGradient gradient; - if (gradient == QLinearGradient()) { + static QLinearGradient darkGradient = [](){ + QLinearGradient gradient; + // FIXME: colors are chosen somewhat arbitrarily and could be fine-tuned, + // or ideally determined by calling a native API. + gradient.setColorAt(0, QColor(47, 47, 47)); + return gradient; + }(); + static QLinearGradient lightGradient = [](){ + QLinearGradient gradient; gradient.setColorAt(0, QColor(235, 235, 235)); gradient.setColorAt(0.5, QColor(210, 210, 210)); gradient.setColorAt(0.75, QColor(195, 195, 195)); gradient.setColorAt(1, QColor(180, 180, 180)); - } - return gradient; + return gradient; + }(); + return qt_mac_applicationIsInDarkMode() ? darkGradient : lightGradient; } static QLinearGradient titlebarGradientInactive() { - static QLinearGradient gradient; - if (gradient == QLinearGradient()) { + static QLinearGradient darkGradient = [](){ + QLinearGradient gradient; + gradient.setColorAt(1, QColor(42, 42, 42)); + return gradient; + }(); + static QLinearGradient lightGradient = [](){ + QLinearGradient gradient; gradient.setColorAt(0, QColor(250, 250, 250)); gradient.setColorAt(1, QColor(225, 225, 225)); - } - return gradient; + return gradient; + }(); + return qt_mac_applicationIsInDarkMode() ? darkGradient : lightGradient; } static const QColor titlebarSeparatorLineActive(111, 111, 111); static const QColor titlebarSeparatorLineInactive(131, 131, 131); +static const QColor darkModeSeparatorLine(88, 88, 88); // Gradient colors used for the dock widget title bar and // non-unifed tool bar bacground. -static const QColor mainWindowGradientBegin(240, 240, 240); -static const QColor mainWindowGradientEnd(200, 200, 200); +static const QColor lightMainWindowGradientBegin(240, 240, 240); +static const QColor lightMainWindowGradientEnd(200, 200, 200); +static const QColor darkMainWindowGradientBegin(47, 47, 47); +static const QColor darkMainWindowGradientEnd(47, 47, 47); static const int DisclosureOffset = 4; @@ -4233,12 +4250,13 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter #ifndef QT_NO_TOOLBAR case CE_ToolBar: { const QStyleOptionToolBar *toolBar = qstyleoption_cast(opt); + const bool isDarkMode = qt_mac_applicationIsInDarkMode(); // Unified title and toolbar drawing. In this mode the cocoa platform plugin will // fill the top toolbar area part with a background gradient that "unifies" with // the title bar. The following code fills the toolBar area with transparent pixels // to make that gradient visible. - if (w) { + if (w) { #if QT_CONFIG(mainwindow) if (QMainWindow * mainWindow = qobject_cast(w->window())) { if (toolBar && toolBar->toolBarArea == Qt::TopToolBarArea && mainWindow->unifiedTitleAndToolBarOnMac()) { @@ -4248,7 +4266,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter p->fillRect(opt->rect, Qt::transparent); p->restore(); - // Drow a horizontal separator line at the toolBar bottom if the "unified" area ends here. + // Draw a horizontal separator line at the toolBar bottom if the "unified" area ends here. // There might be additional toolbars or other widgets such as tab bars in document // mode below. Determine this by making a unified toolbar area test for the row below // this toolbar. @@ -4257,7 +4275,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (isEndOfUnifiedArea) { const int margin = qt_mac_aqua_get_metric(SeparatorSize); const auto separatorRect = QRect(opt->rect.left(), opt->rect.bottom(), opt->rect.width(), margin); - p->fillRect(separatorRect, opt->palette.dark().color()); + p->fillRect(separatorRect, isDarkMode ? darkModeSeparatorLine : opt->palette.dark().color()); } break; } @@ -4272,21 +4290,23 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter else linearGrad = QLinearGradient(opt->rect.left(), 0, opt->rect.right(), 0); + QColor mainWindowGradientBegin = isDarkMode ? darkMainWindowGradientBegin : lightMainWindowGradientBegin; + QColor mainWindowGradientEnd = isDarkMode ? darkMainWindowGradientEnd : lightMainWindowGradientEnd; + linearGrad.setColorAt(0, mainWindowGradientBegin); linearGrad.setColorAt(1, mainWindowGradientEnd); p->fillRect(opt->rect, linearGrad); p->save(); if (opt->state & State_Horizontal) { - p->setPen(mainWindowGradientBegin.lighter(114)); + p->setPen(isDarkMode ? darkModeSeparatorLine : mainWindowGradientBegin.lighter(114)); p->drawLine(opt->rect.topLeft(), opt->rect.topRight()); - p->setPen(mainWindowGradientEnd.darker(114)); + p->setPen(isDarkMode ? darkModeSeparatorLine :mainWindowGradientEnd.darker(114)); p->drawLine(opt->rect.bottomLeft(), opt->rect.bottomRight()); - } else { - p->setPen(mainWindowGradientBegin.lighter(114)); + p->setPen(isDarkMode ? darkModeSeparatorLine : mainWindowGradientBegin.lighter(114)); p->drawLine(opt->rect.topLeft(), opt->rect.bottomLeft()); - p->setPen(mainWindowGradientEnd.darker(114)); + p->setPen(isDarkMode ? darkModeSeparatorLine : mainWindowGradientEnd.darker(114)); p->drawLine(opt->rect.topRight(), opt->rect.bottomRight()); } p->restore();