1
0
forked from ports/opt

qt6-base: cherry picked commits from upstream

This commit is contained in:
Tim Biermann 2024-05-04 20:42:10 +02:00
parent 985855ca90
commit bac85c302c
Signed by untrusted user: tb
GPG Key ID: 42F8B4E30B673606
6 changed files with 417 additions and 25 deletions

View File

@ -1,8 +1,10 @@
untrusted comment: verify with /etc/ports/opt.pub untrusted comment: verify with /etc/ports/opt.pub
RWSE3ohX2g5d/e0jHOMlqokxUFQRiGiQ7SzBMdOlBlWeL/KT2T9zvgyDOoXdgSycfx6v42uK3tkJ1hjTFP7tSz9TZ+5ZW0mKNA4= RWSE3ohX2g5d/SD+6KrnkZvaZRaqmoVe2fC2a73Z9gzRz7lJWvZ1uySopmFMAM4mzviYQmYXF4O/swzF2J/RpO0dlSEzBIJH8Qo=
SHA256 (Pkgfile) = 2a30ab98d7d1fe4137c49a347948610c225cf35e02cd452c0a923f7bde215c76 SHA256 (Pkgfile) = 29b7234c11b5c3d8c69b5e7f57f2648ec048e321655291f76dfad87a442a9988
SHA256 (.footprint) = a8f29665c302ab1ff0823126a39391f31f369effbaf996badc59d27aa04572db SHA256 (.footprint) = a8f29665c302ab1ff0823126a39391f31f369effbaf996badc59d27aa04572db
SHA256 (qtbase-everywhere-src-6.7.0.tar.xz) = 11b2e29e2e52fb0e3b453ea13bbe51a10fdff36e1c192d8868c5a40233b8b254 SHA256 (qtbase-everywhere-src-6.7.0.tar.xz) = 11b2e29e2e52fb0e3b453ea13bbe51a10fdff36e1c192d8868c5a40233b8b254
SHA256 (qt6-base-cflags.patch) = cf707cd970650f8b60f8897692b36708ded9ba116723ec8fcd885576783fe85c SHA256 (qt6-base-cflags.patch) = cf707cd970650f8b60f8897692b36708ded9ba116723ec8fcd885576783fe85c
SHA256 (qt6-base-nostrip.patch) = 4b93f6a79039e676a56f9d6990a324a64a36f143916065973ded89adc621e094 SHA256 (qt6-base-nostrip.patch) = 4b93f6a79039e676a56f9d6990a324a64a36f143916065973ded89adc621e094
SHA256 (qtbase-6.5.3-xkbcommon160.patch) = ee9411953ebdeae8e0a9b782df7db65d7228363c4873e7a8ebd902ee3a44c8c8 SHA256 (fix-qeventlooplocker-regression.patch) = 018c6f0b075db0d05637ee04789688d1e1070218b430a8f255e55b254adcff84
SHA256 (icu.patch) = a13064859ac67ab25888d592bdd277faa69aebc6bb8e6b5a4f012aea2ba50be3
SHA256 (ifdef.patch) = 3f39026f32bf9f7a717a70bbee26b919befeed5e7d6e4dddb8f8aa39a55dbdb1

View File

@ -6,18 +6,25 @@
name=qt6-base name=qt6-base
version=6.7.0 version=6.7.0
release=1 release=2
source=(https://download.qt.io/official_releases/qt/${version%.*}/$version/submodules/qtbase-everywhere-src-$version.tar.xz source=(https://download.qt.io/official_releases/qt/${version%.*}/$version/submodules/qtbase-everywhere-src-$version.tar.xz
qt6-base-cflags.patch qt6-base-cflags.patch
qt6-base-nostrip.patch qt6-base-nostrip.patch
qtbase-6.5.3-xkbcommon160.patch) fix-qeventlooplocker-regression.patch
icu.patch
ifdef.patch)
build() { build() {
patch -d qtbase-everywhere-src-$version -p1 -i $SRC/qt6-base-cflags.patch patch -d qtbase-everywhere-src-$version -p1 -i $SRC/qt6-base-cflags.patch
patch -d qtbase-everywhere-src-$version -p1 -i $SRC/qt6-base-nostrip.patch patch -d qtbase-everywhere-src-$version -p1 -i $SRC/qt6-base-nostrip.patch
patch -d qtbase-everywhere-src-$version -p1 -i $SRC/qtbase-6.5.3-xkbcommon160.patch patch -d qtbase-everywhere-src-$version -p1 -i $SRC/ifdef.patch
patch -d qtbase-everywhere-src-$version -p1 -i $SRC/fix-qeventlooplocker-regression.patch
patch -d qtbase-everywhere-src-$version -p1 -i $SRC/icu.patch
prt-get isinst ccache && PKGMK_QT6+=' -D QT_USE_CCACHE=ON' && PATH="$(echo ${PATH} | awk -v RS=: -v ORS=: '/ccache/ {next} {print}' | sed 's/:*$//')" if prt-get isinst ccache; then
PKGMK_QT6+=' -D QT_USE_CCACHE=ON'
PATH="$(echo ${PATH} | awk -v RS=: -v ORS=: '/ccache/ {next} {print}' | sed 's/:*$//')"
fi
if [[ -e /usr/include/xkbcommon/xkbcommon-x11.h ]]; then if [[ -e /usr/include/xkbcommon/xkbcommon-x11.h ]]; then
PKGMK_QT6+=' -D QT_FEATURE_xcb=ON -D QT_FEATURE_xkbcommon_x11=ON' PKGMK_QT6+=' -D QT_FEATURE_xcb=ON -D QT_FEATURE_xkbcommon_x11=ON'

View File

@ -0,0 +1,203 @@
From 0b494c47d36a8234b1763518c9cddafe62f03715 Mon Sep 17 00:00:00 2001
From: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Date: Wed, 24 Apr 2024 22:33:42 +0200
Subject: [PATCH] Don't quit automatically via QEventLoopLocker if there are open windows
As part of df359bcb703db5a8adbf14e88ba4ae0d54f0cfcd the semantics and
interaction between QEventLoopLocker and QGuiApplication was changed,
based on the assumption that these two mechanisms were independent
and should not affect each other.
This had a surprising regression where the use of QEventLoopLocker in
combination with the QCoreApplication::isQuitLockEnabled() automatic
quit would end up quitting the app, even if it had open windows, for
example when the last job of some internal job queue finished.
It could be argued that if the app has open windows that should not
be closed, they should ignore the Close event, and that an application
with running QEventLoopLocker jobs should maintain an active window
showing the progress of those jobs, but still, this is regression
that we want to fix.
We now bail out if !lastWindowClosed() in QGuiApplication's
canQuitAutomatically, which is triggered from QEventLoopLocker's
isQuitLockEnabled() behavior. And we do so regardless of whether
quitOnLastWindowClosed is set or not, as the latter property
determines the behavior when closing a window, not the behavior
when a QEventLoopLocker goes out of scope.
Similarly, we now block quitting of the application when triggered
by quitOnLastWindowClosed() if a QEventLoop is active, regardless of
the isQuitLockEnabled(), as the latter property is determining
whether we should trigger a quit, not whether we should block them.
[ChangeLog][Important behavior changes] Fixed a regression where
the last QEventLoopLocker going out of scope would quit the app,
even if there were open windows, if quitOnLastWindowClosed was
false.
[ChangeLog][Important behavior changes] Fixed a regression where
closing the last window would quit the app, even if there were
active QEventLoopLockers, if isQuitLockEnabled was false.
Fixes: QTBUG-124386
Pick-to: 6.7 6.5
Change-Id: I84fd0ddea78a2f417f3a17b326113c880079cf85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
---
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 13108ce..bd00f69 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1091,6 +1091,14 @@
\brief Whether the use of the QEventLoopLocker feature can cause the
application to quit.
+ When this property is \c true the release of the last remaining
+ QEventLoopLocker operating on the application will attempt to
+ quit the application.
+
+ Note that attempting a quit may not necessarily result in the
+ application quitting, for example if there still are open windows,
+ or the QEvent::Quit event is ignored.
+
The default is \c true.
\sa QEventLoopLocker
@@ -2094,7 +2102,13 @@
if (!in_exec)
return false;
- if (quitLockEnabled && quitLockRef.loadRelaxed())
+ // The automatic quit functionality is triggered by
+ // both QEventLoopLocker and maybeLastWindowClosed.
+ // In either case, we don't want to quit if there
+ // are active QEventLoopLockers, even if quitLockEnabled
+ // is not enabled, as the property signals whether to
+ // trigger the automatic quit, not whether to block it.
+ if (quitLockRef.loadRelaxed())
return false;
return true;
diff --git a/src/corelib/kernel/qeventloop.cpp b/src/corelib/kernel/qeventloop.cpp
index d318069..e314a17 100644
--- a/src/corelib/kernel/qeventloop.cpp
+++ b/src/corelib/kernel/qeventloop.cpp
@@ -346,7 +346,11 @@
/*!
Creates an event locker operating on the QCoreApplication.
- The application will quit when there are no more QEventLoopLockers operating on it.
+ The application will attempt to quit when there are no more QEventLoopLockers
+ operating on it, as long as QCoreApplication::isQuitLockEnabled() is \c true.
+
+ Note that attempting a quit may not necessarily result in the application quitting,
+ if there for example are open windows, or the QEvent::Quit event is ignored.
\sa QCoreApplication::quit(), QCoreApplication::isQuitLockEnabled()
*/
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 444091a..1d7cd37 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -3675,9 +3675,13 @@
The default is \c true.
- If this property is \c true, the applications quits when the last visible
- \l{Primary and Secondary Windows}{primary window} (i.e. top level window
- with no transient parent) is closed.
+ If this property is \c true, the application will attempt to
+ quit when the last visible \l{Primary and Secondary Windows}{primary window}
+ (i.e. top level window with no transient parent) is closed.
+
+ Note that attempting a quit may not necessarily result in the
+ application quitting, for example if there still are active
+ QEventLoopLocker instances, or the QEvent::Quit event is ignored.
\sa quit(), QWindow::close()
*/
@@ -3733,7 +3737,13 @@
bool QGuiApplicationPrivate::canQuitAutomatically()
{
- if (quitOnLastWindowClosed && !lastWindowClosed())
+ // The automatic quit functionality is triggered by
+ // both QEventLoopLocker and maybeLastWindowClosed.
+ // Although the former is a QCoreApplication feature
+ // we don't want to quit the application when there
+ // are open windows, regardless of whether the app
+ // also quits automatically on maybeLastWindowClosed.
+ if (!lastWindowClosed())
return false;
return QCoreApplicationPrivate::canQuitAutomatically();
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index 6b8700f..d1a50e3 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -1004,8 +1004,8 @@
});
{
- // Disabling QEventLoopLocker support should not affect
- // quitting when last window is closed.
+ // Disabling QEventLoopLocker automatic quit should not affect
+ // quitting when last window is closed if there are no lockers.
app.setQuitLockEnabled(false);
QuitSpy quitSpy;
@@ -1019,8 +1019,40 @@
}
{
- // Disabling quitOnLastWindowClosed support should not affect
- // quitting when last QEventLoopLocker goes out of scope.
+ // Disabling QEventLoopLocker automatic quit should still block
+ // quitting when last window is closed if there is a locker alive.
+ app.setQuitLockEnabled(false);
+
+ QScopedPointer<QEventLoopLocker> locker(new QEventLoopLocker);
+
+ QuitSpy quitSpy;
+ QWindow window;
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+ QTimer::singleShot(0, &window, &QWindow::close);
+ QTimer::singleShot(200, &app, []{ QCoreApplication::exit(0); });
+ app.exec();
+ QCOMPARE(quitSpy.quits, 0);
+ }
+
+ {
+ // Disabling quitOnLastWindowClosed automatic quit should not affect
+ // quitting when last QEventLoopLocker goes out of scope if
+ // there are no windows.
+ app.setQuitLockEnabled(true);
+ app.setQuitOnLastWindowClosed(false);
+
+ QuitSpy quitSpy;
+ QScopedPointer<QEventLoopLocker> locker(new QEventLoopLocker);
+ QTimer::singleShot(0, [&]{ locker.reset(nullptr); });
+ QTimer::singleShot(200, &app, []{ QCoreApplication::exit(0); });
+ app.exec();
+ QCOMPARE(quitSpy.quits, 1);
+ }
+
+ {
+ // Disabling quitOnLastWindowClosed automatic quit should still block
+ // quitting via QEventLoopLocker if there's a window alive.
app.setQuitLockEnabled(true);
app.setQuitOnLastWindowClosed(false);
@@ -1032,7 +1064,7 @@
QTimer::singleShot(0, [&]{ locker.reset(nullptr); });
QTimer::singleShot(200, &app, []{ QCoreApplication::exit(0); });
app.exec();
- QCOMPARE(quitSpy.quits, 1);
+ QCOMPARE(quitSpy.quits, 0);
}
{

165
qt6-base/icu.patch Normal file
View File

@ -0,0 +1,165 @@
From 7c4e1357e49baebdd2d20710fccb5604cbb36c0d Mon Sep 17 00:00:00 2001
From: Fabian Kosmale <fabian.kosmale@qt.io>
Date: Thu, 18 Apr 2024 10:25:21 +0200
Subject: [PATCH] QStringConverterICU: Pass correct pointer to callback
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
Pass the pointer to the current state, not a pointer to a pointer to it.
[ChangeLog][QtCore][QStringConverter] Fixed a bug involving moved
QStringEncoder/QStringDecoder objects accessing invalid state.
Amends 122270d6bea164e6df4357f4d4d77aacfa430470.
Done-with: Marc Mutz <marc.mutz@qt.io>
Pick-to: 6.5
Change-Id: I70d4dc00e3e0db6cad964579662bcf6d185a4c34
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 39bbfce9b675c9085ef49c9b9c52c146eca55e4a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
---
src/corelib/text/qstringconverter.cpp | 4 +-
.../text/qstringconverter/tst_qstringconverter.cpp | 72 +++++++++++++---------
2 files changed, 44 insertions(+), 32 deletions(-)
diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp
index b57498439174..fd45ccf2fdd9 100644
--- a/src/corelib/text/qstringconverter.cpp
+++ b/src/corelib/text/qstringconverter.cpp
@@ -1954,7 +1954,7 @@ struct QStringConverterICU : QStringConverter
const void *context;
ucnv_getToUCallBack(icu_conv, &action, &context);
if (context != state)
- ucnv_setToUCallBack(icu_conv, action, &state, nullptr, nullptr, &err);
+ ucnv_setToUCallBack(icu_conv, action, state, nullptr, nullptr, &err);
ucnv_toUnicode(icu_conv, &target, targetLimit, &source, sourceLimit, nullptr, flush, &err);
// We did reserve enough space:
@@ -1987,7 +1987,7 @@ struct QStringConverterICU : QStringConverter
const void *context;
ucnv_getFromUCallBack(icu_conv, &action, &context);
if (context != state)
- ucnv_setFromUCallBack(icu_conv, action, &state, nullptr, nullptr, &err);
+ ucnv_setFromUCallBack(icu_conv, action, state, nullptr, nullptr, &err);
ucnv_fromUnicode(icu_conv, &target, targetLimit, &source, sourceLimit, nullptr, flush, &err);
// We did reserve enough space:
diff --git a/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp b/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp
index d5fff83321a0..cd4bd8d1b69b 100644
--- a/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp
+++ b/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp
@@ -571,11 +571,10 @@ void tst_QStringConverter::charByCharConsistency_data()
void tst_QStringConverter::charByCharConsistency()
{
- QFETCH(QStringView, source);
- QFETCH(QByteArray, codec);
+ QFETCH(const QStringView, source);
+ QFETCH(const QByteArray, codec);
- {
- QStringEncoder encoder(codec);
+ const auto check = [&](QStringEncoder encoder){
if (!encoder.isValid())
QSKIP("Unsupported codec");
@@ -586,19 +585,28 @@ void tst_QStringConverter::charByCharConsistency()
stepByStepConverted += encoder.encode(codeUnit);
}
QCOMPARE(stepByStepConverted, fullyConverted);
- }
+ };
+
+ check(QStringEncoder(codec));
+ if (QTest::currentTestResolved()) return;
+
+ check(QStringEncoder(codec, QStringConverter::Flag::ConvertInvalidToNull));
+ if (QTest::currentTestResolved()) return;
+
+ // moved codecs also work:
{
- QStringEncoder encoder(codec, QStringConverter::Flag::ConvertInvalidToNull);
+ QStringEncoder dec(codec);
+ check(std::move(dec));
+ }
+ if (QTest::currentTestResolved()) return;
- QByteArray fullyConverted = encoder.encode(source);
- encoder.resetState();
- QByteArray stepByStepConverted;
- for (const auto& codeUnit: source) {
- stepByStepConverted += encoder.encode(codeUnit);
- }
- QCOMPARE(stepByStepConverted, fullyConverted);
+ {
+ QStringEncoder dec(codec, QStringConverter::Flag::ConvertInvalidToNull);
+ check(std::move(dec));
}
+ if (QTest::currentTestResolved()) return;
+
}
void tst_QStringConverter::byteByByteConsistency_data()
@@ -615,11 +623,10 @@ void tst_QStringConverter::byteByByteConsistency_data()
void tst_QStringConverter::byteByByteConsistency()
{
- QFETCH(QByteArray, source);
- QFETCH(QByteArray, codec);
+ QFETCH(const QByteArray, source);
+ QFETCH(const QByteArray, codec);
- {
- QStringDecoder decoder(codec);
+ const auto check = [&](QStringDecoder decoder) {
if (!decoder.isValid())
QSKIP("Unsupported codec");
@@ -632,23 +639,28 @@ void tst_QStringConverter::byteByByteConsistency()
stepByStepConverted += decoder.decode(singleChar);
}
QCOMPARE(stepByStepConverted, fullyConverted);
- }
+ };
+
+ check(QStringDecoder(codec));
+ if (QTest::currentTestResolved()) return;
+
+ check(QStringDecoder(codec, QStringConverter::Flag::ConvertInvalidToNull));
+ if (QTest::currentTestResolved()) return;
+
+ // moved codecs also work:
{
- QStringDecoder decoder(codec, QStringConverter::Flag::ConvertInvalidToNull);
- if (!decoder.isValid())
- QSKIP("Unsupported codec");
+ QStringDecoder dec(codec);
+ check(std::move(dec));
+ }
+ if (QTest::currentTestResolved()) return;
- QString fullyConverted = decoder.decode(source);
- decoder.resetState();
- QString stepByStepConverted;
- for (const auto& byte: source) {
- QByteArray singleChar;
- singleChar.append(byte);
- stepByStepConverted += decoder.decode(singleChar);
- }
- QCOMPARE(stepByStepConverted, fullyConverted);
+ {
+ QStringDecoder dec(codec, QStringConverter::Flag::ConvertInvalidToNull);
+ check(std::move(dec));
}
+ if (QTest::currentTestResolved()) return;
+
}
void tst_QStringConverter::statefulPieceWise()
--
2.16.3

33
qt6-base/ifdef.patch Normal file
View File

@ -0,0 +1,33 @@
From 6810220218cbbf2854ecdedb291f7e4a84b31e54 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Wed, 3 Apr 2024 00:47:01 +0200
Subject: Use ifdef instead of if for __cpp_lib_span
Like the other times it's used in this file
This is causing compilation errors in projects that use -Werror=undef
Fixes: QTBUG-123937
Change-Id: I0cdd2910755dc9079890011dd8dbc27a6e64793e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 699ddcb15b5e981d32ea65d1c1a12f8fa0b06e0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
---
src/corelib/tools/qspan.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/corelib/tools/qspan.h b/src/corelib/tools/qspan.h
index c9de1005a7..d6ae2570ae 100644
--- a/src/corelib/tools/qspan.h
+++ b/src/corelib/tools/qspan.h
@@ -297,7 +297,7 @@ public:
: QSpanBase(il.begin(), il.size())
{}
-#if __cpp_lib_span
+#ifdef __cpp_lib_span
template <typename S, size_t N, if_qualification_conversion<S> = true>
Q_IMPLICIT constexpr QSpanBase(std::span<S, N> other) noexcept
: QSpanBase(other.data(), other.size())
--
cgit v1.2.3

View File

@ -1,18 +0,0 @@
These were removed in libxkbcommon-1.6.0[1] and were apparently
unnecesary. Usage results in build failure.
Just a quick fix while waiting for what [2] comes up with.
[1] https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/70
[2] https://bugreports.qt.io/browse/QTBUG-117950
--- a/src/gui/platform/unix/qxkbcommon.cpp
+++ b/src/gui/platform/unix/qxkbcommon.cpp
@@ -242,4 +242,4 @@
- Xkb2Qt<XKB_KEY_dead_lowline, Qt::Key_Dead_Lowline>,
- Xkb2Qt<XKB_KEY_dead_aboveverticalline, Qt::Key_Dead_Aboveverticalline>,
- Xkb2Qt<XKB_KEY_dead_belowverticalline, Qt::Key_Dead_Belowverticalline>,
- Xkb2Qt<XKB_KEY_dead_longsolidusoverlay, Qt::Key_Dead_Longsolidusoverlay>,
+ Xkb2Qt<0xfe90, Qt::Key_Dead_Lowline>,
+ Xkb2Qt<0xfe91, Qt::Key_Dead_Aboveverticalline>,
+ Xkb2Qt<0xfe92, Qt::Key_Dead_Belowverticalline>,
+ Xkb2Qt<0xfe93, Qt::Key_Dead_Longsolidusoverlay>,