Says GCC 12 with -sanitize address -sanitize undefined:
qfontengine.cpp: In member function ‘bool QFontEngine::processHheaTable() const’:
qfontengine.cpp:386:65: error: array subscript 4 is outside array bounds of ‘const char [1]’ [-Werror=array-bounds]
386 | qint16 ascent = qFromBigEndian<qint16>(hhea.constData() + 4);
| ~~~~~~~~~~~~~~~~~^~~
qbytearray.h:56:23: note: at offset 4 into object ‘QByteArray::_empty’ of size 1
56 | static const char _empty;
| ^~~~~~
(repeats several times)
The compiler apparently assumes that data() and size() are independent
of each other, and so finds that that constData() may return &_empty,
which is a const char[1].
For some reason, storing the result of constData() in a temporary and
indexing off of that fixes the issue.
Potentially adding Q_ASSUME(d.data()[d.size] == '\0'); in some
strategic place would fix it, too, but would incur runtime overhead.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105348
Task-number: QTBUG-103923
Pick-to: 6.3 6.2
Change-Id: Ia6e24e01d1c2a6bd9d91d4d082df9fba0d5c668f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
An aliased line painted directly on top of the top edge of the clip
rect will work fine when there is no scaling, since the coordinates
will snap downwards. When a fractional scaling is applied however, the
main part of the line width will sometimes fall outside the clip rect,
and so the coordinates will snap it outside, and hence it will not be
painted.
Fix by shifting the y coordinate by .5, to place the center coordinate
of the line to the center of the intended pixel.
Fixes: QTBUG-88934
Task-number: QTBUG-96223
Pick-to: 6.3 6.2
Change-Id: I3ab042bc964eac6ce359d40428c4d79cde9cb78c
Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add test of explicitly prepared qcolortransform, this is a state
a transform can get into if used for an image transform.
Also cleans up the test code.
Change-Id: I9445ed114bed0edc790e14024aaae6a42989220b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
QTestEventLoop is used by QSignalSpy::wait. If tests want to verify
that a signal gets emitted within a second or less, we should use
a precise timer to reduce the chance of timer imprecision breaking
the test.
Change-Id: I2a2ca3bbdcaf032288f1fdc2aecc6afd05a6c76c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
[ChangeLog][QtGui][QPainter] In Qt 5, the predefined brush patterns
would always be transformed along with the object being painted. In Qt
6.0 onwards, they would or would not, depending on the
SmoothPixmapTransformation render hint. Instead of this somewhat
surprising behavior, make the default be untransformed
(i.e. cosmetic), which makes sense when it comes to dpr scaling. For
the cases where one wants scaling, a new render hint is introduced to
enable that: NonCosmeticPatternBrushes.
Change-Id: I2208c7a28af9056d7ab97a529b66bf2d502c3c4f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
QScopedValueRollback has a few users that apply it on QAtomicInt,
which happens to work as QAtomicInt is copy-constructible and its
ctors are implicit.
But that's of course nonsense. We don't need to store the oldValue in
an atomic, nor do we need to pass the new value into the ctor as an
atomic.
So, add a QAtomicScopedValueRollback which works on std::atomic as
well as the Qt atomics, but distinguishes between the reference (which
is atomic) and the value (which isn't), and use it in one of the
users, tst_QList.
Keep it private until we know whether there's an actual need for this.
The test is a copy of tst_qscopedvaluefallback, so the occasional
oddity (like atomic op*=) should be ignored.
Task-number: QTBUG-103835
Change-Id: I3c05b3e51f465698657a02ca5521ed465386e9a6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The \value command supports a [since ...] parameter. We might as well
use it, to standardize how we document when enum members were added.
Change-Id: I68a101e8101f780d0e6607a63723aa1bd837bb56
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
At least for my FreeBSD this makes sense. The default debugger search is
gdb first then lldb on Linux-not-Android and for QNX (qcc is GCC after
all), but lldb first everywhere else.
With LLVM14 from Ports, I get:
$ tests/auto/corelib/tools/qhashseed/tst_qhashseed | head -1
********* Start testing of tst_QHashSeed *********
Config: Using QtTest library 6.4.0, Qt 6.4.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by Clang 14.0.0), freebsd 13.0
=== Received signal at function time: 1ms, total time: 3ms, dumping stack ===
(lldb) process attach --pid 1782
Process 1782 stopped
Executable module set to "/usr/home/tjmaciei/obj/qt/qt6/qtbase/tests/auto/corelib/tools/qhashseed/tst_qhashseed".
Architecture set to: x86_64--freebsd13.0.
(lldb) bt all
* thread #1, name = 'tst_qhashseed'
* frame #0: 0x0000000800f227c8 libc.so.7`_wait4 at _wait4.S:4
frame #1: 0x00000008003243bc libthr.so.3`__thr_wait4(pid=<unavailable>, status=<unavailable>, options=<unavailable>, rusage=<unavailable>) at thr_syscalls.c:581:8
frame #2: 0x00000008002b9c73 libQt6Test.t.so.6`(anonymous namespace)::StackTraceHandler::generate() at qtestcase.cpp:393:9
[...]
=== End of stack trace ===
Received signal 13
Function time: 1ms Total time: 3ms
Support for Windows left as an exercise for later. The
WindowsFaultHandler code doesn't even call generateStackTrace().
Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eba471f58ff3cb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
So we can mark the bottom page as inaccessible, thus be able to catch a
stack overflow in the handler itself. Our code shouldn't cause
overflows, but it's possible that a chained handler does more work than
expected.
Pick-to: 6.3
Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb83a294ab7958
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
We don't need two or even three buffers for the current directory. In
the worst case, we had a 260-byte buffer on the stack, a larger one on
the heap (new[]/delete[]) and then a copy of it in QString.
Now, we shall have only one and it could be "gifted" to QFileSystemEntry
via std::move() (requires separate patch to take the QString by rvalue-
ref).
Pick-to: 6.3
Change-Id: Ibcde9b9795ad42ac9978fffd16f2bb2a443697d6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
We've just allocated a buffer of 'size' size, which is bigger than
PATH_MAX, but told GetCurrentDirectory() that its size is PATH_MAX.
Fixes: QTBUG-103852
Pick-to: 5.15 6.2 6.3
Change-Id: Ibcde9b9795ad42ac9978fffd16f2ba2cd8712cb7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Use an unversioned link to the online documentation, ensuring we
link to the latest version of this page.
Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-102787
Change-Id: I285356687a3873fb861a54d003185f2b751c1b72
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
[ChangeLog][Third-Party Code] Vulkan API Registry is available not only
under MIT License, but also Apache License 2.0. Make this explicit in
the license documentation.
Pick-to: 6.2 6.3
Change-Id: I6f07a7970319aef0a26f291de1eff7c316195802
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
And some s,SSL,TLS, in the same paragraphs.
Changing SSL to TLS in the whole codebase looks odd given classes are
still called QSsl*, but may be worth considering at some point.
Pick-to: 6.3 6.2
Change-Id: I06dfcd99c1f6ac9e029e1914363344b3705d871f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Commit contains the new QT_ANDROID_SIGN_APK variable. It extends
*make_apk target by signing the package with the specified key.
For key setup these environment variables must be set:
- QT_ANDROID_KEYSTORE_PATH
- QT_ANDROID_KEYSTORE_STORE_PASS
- QT_ANDROID_KEYSTORE_ALIAS
- QT_ANDROID_KEYSTORE_KEY_PASS
Task-number: QTBUG-97107
Change-Id: If42c74298c1b385889b32517ab7f1f5b0628b487
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The example does not use OpenGL in Qt6 anymore so the dependency is not
necessary.
Change-Id: I6189a93eb65bd283ea7e85664582ab0b12a41639
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Such semantics have been dropped from Qt 6.
Change-Id: I12f3478833afafa34f9075faf9ed030d06cd86f9
Pick-to: 6.2 6.3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For the C side, I don't think any of the constexpr macros have ever been
in use, but I'm leaving them.
Change-Id: Ieb9a2aa1ea914b1b956bfffd16eff47db2d26e4e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Superseded by the C++17 check in qglobal.h applicable to 6.0, but only
added for 6.2 (commit 647c0e80ed).
Change-Id: Ieb9a2aa1ea914b1b956bfffd16effa512e6f1e4a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
As with method signatures, register class names using template function
specialization in the QtJniTypes namespace, and then declare C++ types
as JNI classes with a class name string. Such classes implicitly get
registered as JNI types as well.
Add a QJniObject construct method (since C++ constructors that are
templates cannot be explicitly instantiated with a type), and a
QJniEnvironment::findClass overload.
Add test coverage, also for the recently added macros for native
methods.
As a drive-by, change the name of the Q_JNI_DECLARE_NATIVE_METHOD
macro to Q_DECLARE_JNI_NATIVE_METHOD for consistency.
Change-Id: Ic19562d78da726f202b3bdf4e9354e8ad24d8bd9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Currently it is only possible to create a cube map texture from a single
compressed texture file. In many cases, the cubemap asset is available
as a set of individual image files. Making it possible to use these
images directly will make the development process more efficient, and
will reduce the size of the assets needed to be shipped with demos and
examples.
Task-number: QTBUG-103191
Change-Id: Icd12548e2dab55ec2123804cb28353cbf29926ce
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Most properties are, but some properties (such as useHoverEffects or
showShortcutsInContextMenus) can be set by the application.
Pick-to: 6.3 6.2
Change-Id: Ia6e0563a892f26456d595026f6c82502a9e888da
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Added a small helper function that also installs the script to
prefix builds. Additionally, leveraging the cmake option
CROSSCOMPILING_EMULATOR for the testrunner fits neatly in the rest
of our cmake code.
Change-Id: I75288e97c81b250ac3997f2e7a22bc7bd82b7b69
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The default value None returned by tools.get_safe is not the Python's
built-in None value. The value returned by tools.get_safe() is wrapped
into conans.model.options.PackageOption and to check against 'None'
it needs to follow pattern:
if not <value>:
Pick-to: 6.3
Change-Id: Idacfdde92958a46d399246239d12cd887916c4f1
Reviewed-by: Toni Saario <toni.saario@qt.io>
... and bindingStatus()
QBindingStatus* is the final state of the value chain in
m_statusOrPendingObjects, so we can use the Double-Checked Locking
Pattern to avoid locking the mutex when we already have a status - it
won't go away again, unlike the vector in the List state.
To enable the change, make the data member an atomic<>. All loads and
stores can continue to use memory_order::relaxed, except the loads of
a potential status, which have to acquire, and the store of the
status, which has to release. This creates the necessary
synchronizes-with relation. So even though we synchronize out of
middle of the mutex critical section in QThread::exec() this way,
there's no data race between QThread::exec() and a potential
bindingStatus() call.
Change-Id: I0e0b7bd305649fa5f56a0f8723fb75f2577b90dd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This allows to set up everything first - without paying for the layout
calculation at every step - and only then trigger the layout once.
Results:
0.065 msecs to create a QGraphicsTextItem with some text (layouted)
0.036 msecs to set everything up in a QGraphicsTextItem with 0 width
Change-Id: I138bd1d58941d029bc0a36d2730216778f1fbd97
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This way we can handle keyboard shortcuts for actions in that menu as
well in our menuHasKeyEquivalent implementation. This allows the focus
widget to accept the override, and e.g. a QKeySequenceEdit to record
Cmd+Q which with a plain NSMenu will just quit the application.
Pick-to: 6.3 6.2
Fixes: QTBUG-103590
Change-Id: I84597307aef8f0ab65d97d78e5aa15e5cf2e707d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The "ReleaseId" key's value stopped updating since
Windows 10 20H2, so we should query the new "DisplayVersion"
key when running on Windows 10 20H2 and onwards.
Change-Id: Ifaa8287f9812126bde0390337af0cda23ff8e529
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Before it was only tested indirectly as part of the qcolorspace
tests. This also fixes a rounding for maximum RGB64 values.
Pick-to: 6.3
Change-Id: I6106e662c0f9d00c0b3a0c13213cb051ea39e14e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The GNU binutils ld linker needed a patch after the tagging of 2.38 to
make the new feature work. Before this patch, the linker will fail to
link when protected visibility symbols are used in the library, so don't
enable the feature unless the linker is recent enough.
GNU binutils gold from that version passes this test.
LLVM lld is unknown (I didn't test), but LLVM was consulted in
developing the feature.
Fixes: QTBUG-103493
Change-Id: Ibcde9b9795ad42ac9978fffd16f1c80ca20953ff
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This class is dllexport'ed and has members that refer to classes that
are only forward-declared in the header (such as QRegularExpression,
used in std::vector). GCC and MSVC appear to emit the destructor at the
point where it is used, which I guess is the vtable, which probably
means where the constructor was inlined because I don't see any virtual
overrides. Clang (at least in the form of ICX) appears to emit it at the
class declaration point.
C:\Qt\qt-everywhere-src-6.3.0\qtbase\src\gui\itemmodels/qfilesystemmodel_p.h(94,20): note: in instantiation of member function 'std::vector<QRegularExpression>::~vector' requested here
class Q_GUI_EXPORT QFileSystemModelPrivate : public QAbstractItemModelPrivate
^
C:\Qt\qt-everywhere-src-6.3.0\qtbase\src\gui\itemmodels/qfilesystemmodel_p.h(94,20): note: in implicit destructor for 'QFileSystemModelPrivate' first required here
C:\Qt\qt-everywhere-src-6.3.0\qtbase\src\gui\itemmodels/qfilesystemmodel_p.h(94,7): note: due to 'QFileSystemModelPrivate' being dllexported
Fix by defining both the default ctor and the dtor out-of-line.
Task-number: QTBUG-45582
Fixes: QTBUG-103605
Pick-to: 5.15 6.2 6.3
Change-Id: I77c8221eb2824c369feffffd16f08ee39004a825
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use the opportunity to modernize the code to use an
initializer list instead of stream operators.
This then makes it easier to generate a comma-delimited
list that works for Python as well.
Fixes: PYSIDE-1942
Change-Id: I5291b55bd0685e06ad62e52c7ebccffce98e9c23
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
C++20 added this as a more light-weight alternative to std::decay.
Task-number: QTBUG-103739
Change-Id: Icbb973d9500a0d1425859f8f104b7aef1ec917f1
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
We don't want to require users to say
#include <functional>
#include <q20functional.h>
because that would leave duplicated <functional> includes after a
mechanical s/q20functional.h/functional/. Mechanical transformation is
the major design goal of the qNN namespaces, so fix this before we use
the header in ever more places.
Pick-to: 6.3
Change-Id: Id258c36a042214f41b737fb7ab60906cc8e76ca6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The body was still referring to the Qt 5 QMap where the same key could
be mapping to multiple values. That's no longer the case in Qt 6.
Change-Id: Idb1786ac45f328c318878fa52bf5d43d79c0178a
Pick-to: 6.2 6.3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Useful for tests that request permissions and need to ensure these
are requested on behalf of the app itself, and not its parent process,
regardless of how it's invoked.
Change-Id: Iac493e95440a3a04df4fa466c1d700ba1233e393
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Attempting to use an invalid QStringConverter would so far have resulted
in a crash, as we would dereference the null iface pointer.
Fix this by inserting adequate checks, and ensure that hasError returns
true if we attempt to en/decode with an invalid converter.
Pick-to: 6.2 6.3
Change-Id: Icf74bb88cd8c95685481cc0bd512da99b62f33e6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>