Commit Graph

56067 Commits

Author SHA1 Message Date
Liang Qi
46d047b76c QMimeData: return null string for null byte array
This is a cherry modification of 5826a7ad92
in 5.15 branch.

Fixes: QTBUG-102438
Pick-to: 6.3 6.2
Change-Id: I8bdb7cb2537c6df7bb1381871b3cc2446ff1d270
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-04-19 09:57:12 +02:00
Moody Liu
4088b27b93 Explicitly check for atomic addition and relaxed load operation support
...and properly find and link against `libatomic` using find_library.
This fixes the qtdeclarative build on the RISC-V platform.

Initial-patch-by: Sprite <SpriteOvO@gmail.com>
Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-99234
Change-Id: I2b5e4812886ce45cb02bed3106ce8c519b294cbe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-04-18 15:01:53 +00:00
Marc Mutz
a0858c639e tst_qstringapisymmetry: check toInt() etc also with base != 0
This shows we're lacking support for the 0b prefix, and, as it turns
out, there's a request for it.

Task-number: QTBUG-85002
Pick-to: 6.3
Change-Id: Ie201c84bf906a7e482b929301699ceb429b53c14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-17 21:55:23 +02:00
Marc Mutz
c948d3ce11 QFutureCallOutEvent: remove unused pseudo-copy-ctor
This constructor was used in the previous implementation of
clone(). The current implementation uses the compiler-generated
copy-constructor.

Change-Id: Ibae163653e43ceb2b07872b496cd004e50b1e625
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-15 13:43:51 +02:00
Lorn Potter
0ec75f4b99 wasm: use emscripten::val for specialHTMLTargets
We need to add specialHTMLTargets to EXPORTED_RUNTIME_METHODS in order
to use it, as Emscripten does not export it.

Also, EM_ASM is not allowed for SIDE_MODULES, so it's better to use
emscripten::val methods.

Change-Id: I9b352ac98e2a961157f5bb36456bec3e35891270
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-04-15 21:06:32 +10:00
Allan Sandfeld Jensen
830b1550de Fix race condition in futex-based QSemaphore
Add one and reset the wakeAll bit atomically.

This avoids a race in a case where an acquiring thread
is owning the semaphore, and deleting it after a
set number of releases (one for each thread referencing the semaphore).

Two releasing threads could enter the if statement under
futexNeedsWake(prevValue), the counter been incremented at
this point and reached the value being acquired, meaning the thread
acquiring can be awakened by just one of the two releasers,
delete the semaphore, and then the second releaser would access
the now deleted semaphore.

The patch avoids that by unsetting and reading the wakeAll bit
atomically, so only one thread will try to wake all threads.

Pick-to: 6.3 6.2 5.15
Fixes: QTBUG-102484
Change-Id: I32172ed44d74378c627918e19b9e1aaadb5c6d1d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-15 10:27:52 +02:00
Volodymyr Zibarov
8b3f2dd994 TextEdit: Avoid scrolling to cursor during app switch on GNOME
GNOME sends empty InputMethod event when switching applications
with Alt-Tab. As long as this event is empty, we don't need to
scroll to cursor, because we're not adding any input text to it.

This also fixes "out of scope" bug QTCREATORBUG-26628

Fixes: QTBUG-100039
Task-number: QTCREATORBUG-26628
Pick-to: 6.2 6.3
Change-Id: I3ccfea50ae52f6f0cbf82c29f07944894050e7dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-14 23:08:54 +03:00
Giuseppe D'Angelo
41a7546789 QDate(Time): add a addDuration method
To complement the existing addSecs / MSecs / etc., add a function
that takes any compatible std::chrono::duration.

QTime also features similar functions, but it's also "unique" in that
it uses modular arithmetic (it wraps around in case of "overflow").
I'm not so sure that adding durations to a QTime object therefore
makes sense, and I'm not doing it in this patch.

[ChangeLog][QtCore][QDate] Added addDuration().
[ChangeLog][QtCore][QDateTime] Added addDuration().

Change-Id: I02aa37ff024d7f56fa976dc8f4f73523bdba8d94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-14 21:56:56 +02:00
Marc Mutz
3141a13b2a QFutureCallOutEvent: de-export again
A previous commit Q_CORE_EXPORTed this class so it could be used in
tst_qevent. But we can also keep it Q_AUTOTEST_EXPORTed and make the
testing of the class subject to QT_BUILD_INTERNAL on the test side.

That's what this patch does.

Change-Id: I9bd5f80ada856b7db4b39dfb59b32bd825416c13
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-04-14 19:07:16 +02:00
Marc Mutz
da0f72ebb8 QEvent: start to de-inline copy ctor and clone() of all subclasses
There's no advantage to them being inline: Absent de-virtualisation,
clone() is only supposed to be called through the vtable, and the copy
ctor is only supposed to be used in the implementation of clone().

And when the compiler de-virtualises, we don't want the code
duplication associated with inlining.

Enforce this by introducing new macros to hide the boilerplate.

This fixes missing out-of-line dtors in:
- QSinglePointEvent
- QApplicationStateChangeEvent
- QFutureCallOutEvent

Wrong covariant return in:
- QFutureCallOutEvent

And missing clone() reimplementations in:
- QCloseEvent
- QIconDragEvent
- QShowEvent
- QHideEvent
- QDragEnterEvent
- QDragLeaveEvent

While these don't carry extra data or members, a dynamic_cast of the
result of clone() as well as using the expected covariant return value
would fail:

   QShowEvent *e = ~~~;
   QShowEvent *e2 = e->clone(); // ERROR: converting QEvent* to QShowEvent*

Check that reimplementing clone() is binary compatible (covariant
returns may change the numerical pointer value returned, cf.
https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B).

The copy-assignment operator stays inline for the time being, as the
goal is to = delete it in the future.

This patch covers, roughly, QtCore and QtGui.

[ChangeLog][QtGui][QEvent subclasses] Fixed missing clone()
reimplementations on QCloseEvent, QIconDragEvent, QShowEvent,
QHideEvent, QDragEnterEvent, and QDragLeaveEvent.

Task-number: QTBUG-45582
Task-number: QTBUG-97601
Change-Id: Ib8a0519dbe85a7a8da61050d48be338004dfa69a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-14 19:07:16 +02:00
Edward Welbourne
ec59ae6189 Spacing-only change: fix indents and spacing in qtestcase.cpp
Separated from other clean-ups to avoid inanity 'bot complaints.

Change-Id: Ia33f87da224dba7c50bbf14beb642825dc46fe90
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-14 16:58:17 +02:00
Edward Welbourne
f3184770e2 qtestcase.cpp: s/QString::fromLatin1/QLatin1String/ where viable
Now that QL1S has its own arg(), we can use that directly instead of
going via QString before calling arg(). Only works in most cases, as
the QL1S::arg() overload set is more limited.

Change-Id: Ie4c566c5998538b1b8a953b1ba4481e0f1663bf7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-14 16:58:17 +02:00
Sona Kurazyan
adad2a468d Android: replace remaining uses of QLatin1String with QLatin1StringView
Task-number: QTBUG-98434
Change-Id: I35a97eef61746039738b4a5f2271c3bffd5711b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-04-14 15:29:06 +02:00
Sona Kurazyan
b28ed7fdc2 Android: use _L1 for for creating Latin-1 string literals
Task-number: QTBUG-98434
Change-Id: I5ee5fe079c9a4530f636e59f6171abfa523591f4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-04-14 15:29:06 +02:00
Sona Kurazyan
d0a08d1f11 Android: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.

As a drive-by, fix qsizetype -> int narrowing conversion warnings for
the touched lines.

Change-Id: Iebcbdbd7cecac09d0a7039e3ef6a4509d33039ba
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-04-14 15:29:06 +02:00
Joerg Bornemann
252e3a1526 CMake: Add rudimentary c++2b feature
This fixes the "Could not find feature c++2b." error when building a Qt
module with qmake.

The feature is OFF by default for now.

This amends commit b5ed3cb7ba.

Pick-to: 6.2 6.3
Change-Id: Ibabe3ce29275699e66ab1f32d19d583d6bcede9e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-14 09:28:06 +02:00
Thiago Macieira
fbe6f19853 QBENCHMARK: Replace the double underscore with something not reserved
Clang with -Wreserved-identifier complains.

Pick-to: 6.3
Fixes: QTBUG-102431
Change-Id: If2e0f4b2190341ebaa31fffd16e441ee35b0e3b9
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-04-14 03:17:42 +00:00
Thiago Macieira
c87c2b0544 QObjectPrivate:Connection:: use NSDMI for the ref count
Can't use it for the bit in the bit field until C++20.

Change-Id: If2e0f4b2190341ebaa31fffd16e313f64d52c26a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 20:17:38 -07:00
Thiago Macieira
06c2478762 QObjectPrivate: deinline a bunch of stuff only used in QtCore
All of this connection management code is used only in QtCore and
mustn't be touched by other modules (not even qtdeclarative). So there's
no reason for it to be around and slow down the compilation time of
everything using QObjectPrivate.

Change-Id: If2e0f4b2190341ebaa31fffd16e31313f1b7020f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 20:17:27 -07:00
Thiago Macieira
d1e9cab81c QObjectPrivate: use placement new/delete for SignalVector
Just to be pedantically correct, but also makes the construction code
slightly more readable.

Pick-to: 6.2 6.3
Change-Id: I29f1c141c0f7436393d9fffd16e2bbf0f361c024
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 20:17:25 -07:00
Thiago Macieira
bc6087fce2 QObjectPrivate: use ConnectionList's constructor instead of copy-assignment
For all new elements, this is the correct thing to do. This seems to
work around an MSVC compiler bug on ARM64. It also seems to generate
better code for x86-64 too, as a nice bonus.

See: https://developercommunity.visualstudio.com/t/codegen-elides-initializers-when-copying/10004323
Before: https://msvc.godbolt.org/z/Wcd4haaPd
After: https://msvc.godbolt.org/z/vWYjazWGr, https://gcc.godbolt.org/z/hdsvTq9nE

Fixes: QTBUG-102246
Pick-to: 6.2 6.3
Change-Id: I29f1c141c0f7436393d9fffd16e2bbbf4c0fe54d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 20:17:23 -07:00
Ilya Fedin
974a7bd6e0 FileChooser portal: set current_name
Fixes: QTBUG-100297
Pick-to: 6.3 6.2
Change-Id: I5d41e01aafeccce2d886debdb595b4c87b03a043
Reviewed-by: Jan Grulich <jgrulich@redhat.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-14 03:52:52 +04:00
Giuseppe D'Angelo
7de83f06c1 QDateTime: add conversions for time_point and zoned_time
In C++20, QDateTime is a direct equivalent of a sys_time<milliseconds>
time point. (Before, it might not have been, because system_clock before
C++20 was not guaranteed to be tracking Unix time, AKA UTC time without
leap seconds.) To be specific, sys_time<milliseconds> corresponds to
a QDateTime using the Qt::UTC timespec.

This patch:

1) adds named constructors taking time_points:

* a generic one taking any time_point convertible (via clock_cast) to
  a system_clock (this obviously includes system_clock, but also e.g.
  utc_clock)

* another couple taking local_time, interpreted as a duration from
  1/1/1970 in local time.

2) adds a named constructor from zoned_time (i.e. a sys_time + a
   timezone), that we can easily support via QTimeZone.

3) add conversion functions towards sys_time, matching the existing
   to(M)SecsSinceEpoch() functions.

[ChangeLog][QtCore][QDateTime] QDateTime can now be constructed
from std::chrono::time_point objects (including local_time), as
well as from std::chrono::zoned_time objects. Moreover, they
can be converted to std::chrono::time_point using system_clock
as their clock.

Change-Id: Ic6409bde43bc3e745d9df6257e0a77157472352d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 18:45:54 +02:00
Sona Kurazyan
a5b9600356 QtGui: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.

Change-Id: I308d86cefcbfd126929b68f9a853d420840c965f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-13 18:34:15 +02:00
Giuseppe D'Angelo
2e29f55f76 QDate: add conversions for std::chrono calendaring classes
std::chrono::year_month_day and related classes offer very
convenient to specify dates.

This patch adds implicit constructors to QDate to support this
convenience, e.g.:

  // YYYY-MM-DD, DD-MM-YYYY, MM-DD-YYYY formats:
  QDate d1 = 1985y / December / 8;
  QDate d2 = 8d / December / 1985;
  QDate d3 = December / 8d / 1985;

  // Indexed weekday:
  QDate d4 = 2000y / January / Monday[0];
  QDate d5 = 2000y / January / Monday[last];

and so on.

These are all implemented using the conversion from the std
calendaring classes to sys_days. Conversions between sys_days
and QDate are also added, since they're basically "for free".

I don't expect "ordinary" users to stumble upon it, but it's
worthy mentioning that std::chrono::year *does* have a year
zero (hence, year_month_day in year 0 or below are offset
by one with the corresponding QDate). I've left a note
in the documentation.

[ChangeLog][QtCore][QDate] QDate (and therefore QDateTime)
is now constructible using the year/month/day/week classes
available in the std::chrono library. Moreover, it now
features conversions from and to std::chrono::sys_days.

Change-Id: I2a4f56423ac7d1469541cbb6a278a65b48878b4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 18:08:38 +02:00
Giuseppe D'Angelo
33c88f86b5 QAbstractProxyModel: do not access invalid indexes
QAbstractProxyModel::headerData tries to do the "smart" thing and
map sections in the proxy to sections in the source. However there's
no "mapSectionToSource" virtual. Instead, to map horizontal headers, the
code builds a proxy index at row 0 and section N, maps it to the source,
and finds out which source column it gets mapped to. (Same story
for the vertical headers).

... in general this can obviously fail, say you've got a "horizontal
scrambling" proxy model, but in the common case this is OK.

Except, if the proxy is empty (e.g. 0 rows or columns). In this case,
it asks for an illegal index, and if you reimplemented index() yourself
(which you must, since it's a pure virtual in QAPM) and you do bounds
checking, you'll not be pleased at the result.

This turns out to be a massive API liability. To fix this somehow properly,
we can decide that empty models don't get the section remapped (easy).
Less easy is the fact that, when the model does get some data, we have to
emit headerDataChanged() otherwise the views will get broken. So add
this logic too.

Note that QAPM does not normally forward any source model's signal -- a
subclass has to connect to them and handle them explicitly. That's
*another* API liability, all over the place -- data(), headerData(),
flags(), etc.

What I mean by this is that one can create a valid QAPM (by implementing
its pure virtuals) that however is immediately broken by the convenience
that QAPM provides for the rest (data(), headerData(), etc.).

This commit doesn't try and change this in any way, but I'm less and
less convinced of the usefulness of QAPM in its current shape.

Change-Id: I45a8c2139f2c1917ffbf429910fdb92f005f4feb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
2022-04-13 18:08:38 +02:00
Joerg Bornemann
fd8441a97c CMake: Fix error message for failing OpenGL tests
We still mentioned the QMAKE_* variables.
Replace them with the OpenGL_DIR CMake variable.

Pick-to: 6.2 6.3
Change-Id: If53c2bff030cf03cb43d10f738949f59ac8dd730
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-04-13 12:41:23 +02:00
Joerg Bornemann
743bb66744 Avoid rebuilds when changing sources belonging to bootstraplib
Whenever a source file is touched that belongs to the bootstrap library,
all bootstrap tools are rebuilt.  This includes moc.  The moc binary
however, is a dependency whose invalidation results in a rebuilt of
quite some parts of Qt.

There's no easy way to turn off this dependency.  To mitigate the
rebuilds, the bootstrap lib now can use a copy of the corelib sources.
That means the bootstrap lib is not rebuilt if its sources are changed.
This is basically the situation we had in Qt5.

The sources are not updated on reconfiguration.  There's a new target
'update_bootstrap_sources' that can be built to update the copied source
tree of the bootstrap lib.

This new behavior can be controlled with the variable
QT_USE_BOOTSTRAP_SOURCE_COPY.  It's on by default for developer builds.

Fixes: QTBUG-92269
Change-Id: I50234df66590c39594d208424394c7a600dc5606
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-13 12:41:14 +02:00
Marc Mutz
ef895869b4 QVarLengthArray: add missing (size, value) ctor
Extend the corresponding test in tst_containerapisymmetry.

[ChangeLog][QtCore][QVarLengthArray] Added (size, value) constructor.

Fixes: QTBUG-102469
Change-Id: I4802eebe6ba1a6835e4d6f41e1d3db2a0d7c7894
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 08:10:47 +02:00
Tang Haixiang
7a7023b7b1 Chip example: fix an accidental bool->int conversion when using PMF connections
The example was refactored to use the PMF connection syntax.
However this introduced a problem: when connecting a QAbstractButton
to a slot that has a default parameter, the semantics of the connection
change between string-based connections and PMF.

Specifically: when connecting the

  QAbstractButton::clicked(bool checked = false)

signal to a slot like

  View::zoomIn(int level = 1)

then a string-based connection like

  connect(button, SIGNAL(clicked()), this, SLOT(zoomIn()))

would call zoomIn without carrying the signal's parameter over.
In other words, zoomIn's parameter is defaulted. The same connection
using PFM instead is

  connect(button, &QAbstractButton::clicked,
          this, &View::zoomIn)

which would "connect" the arguments. This makes emissions that pass
false as clicked's parameter result in a zoomIn by 0.

Fix it by avoiding the default parameter of zoomIn -- just split
the function in two (zoomIn and zoomInBy).

Amends 8cf8122314.

Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-100135
Done-with: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Change-Id: I10c150c648034449e3154140108de2d64326d965
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-04-13 11:36:34 +08:00
Morten Sørvig
28e0c938bf wasm: remove SAFE_HEAP=1
This adds significant run-time overhead and should not be on by default.

Pick-to: 6.3
Change-Id: I33d312e31bd714f696d8acf2066eb4b285ff04af
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-04-13 00:26:09 +00:00
Ilya Fedin
311d29d226 Fix build on CentOS 7
This little change fixes the build on CentOS 7

Pick-to: 6.3
Change-Id: Ic9717147c10ca78e36d6311944de417c6420211d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 03:24:05 +04:00
Giuseppe D'Angelo
0a17a0da61 QDateTime: add support for std::chrono::duration arithmetic
QDateTime represents a specific point in time, so arithmetic
with durations makes perfect sense.

Moreover, we can finally equip QDateTime with a subtraction
operator, to calculate the duration between two QDateTime
objects.

[ChangeLog][QtCore][QDateTime] QDateTime now supports arithmetic
between QDateTime objects and std::chrono::duration objects.
A duration can be added to or subtracted from a QDateTime, yielding
another QDateTime; and two QDateTime objects can be subtracted
from each other, yielding the duration between them.

Change-Id: I656419f3bb9418c49f0e2fd0800c3dbaaf6aff32
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 01:24:04 +02:00
Marc Mutz
b36de79ffd QVarLengthArray: simplify SFINAE on resize(n, v)
Use our usual if_x<> = true pattern to move the constraint to where it
belongs (absent C++20 requires-clauses): into the template argument
list.

Amends a00a1d8806.

Change-Id: I846b96bdeec3def221346897181d3d4d3a55316d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-04-13 01:16:22 +02:00
Marc Mutz
acb9633efa QXmlStreamSimpleStack: disable copy and move SMFs
Clazy complained that the class has a dtor, but no copy ctor.

Pick-to: 6.3
Change-Id: Ida4024df1ff22c7758b8efa6e9383e03734720a8
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-04-13 01:16:22 +02:00
Marc Mutz
a986a8c099 QXmlStreamPrivateTagStack: don't fail on more than 2Gi chars in the tag stack
QXmlStreamPrivateTagStack holds the string data in a single large
QString, which, on 64-bit platforms, can hold more than INT_MAX
characters' worth of data. However, the code managing this QString
still used int variables instead of qsizetype, making failure for such
large tag string data all but inevitable, even though I didn't go to
the length of actually constructing a failing test case.

Fix by using qsizetype instead of int where required.

Fixes: QTBUG-102467
Pick-to: 6.3 6.2
Change-Id: I50b7e194e43f3c7dce69c6e1fd4682fc517dd7d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 01:16:22 +02:00
Marc Mutz
9c028b0ff4 XmlStringRef: fix length truncation
The XmlStringRef(const QString*) ctor calls the (const QString *, int,
int) ctor, passing QString::length() as the third argument. If the
input QString had more than 2 Gi characters, the resulting
XmlStringRef represents only the prefix of the input (mod
(INT_MAX+1)).

Fix by making the delegatee ctor use qsizetype instead of int,
allowing to pass data through without truncation.

[ChangeLog][QtCore][QXmlStreamReader] Fixed several bugs regarding
handling of documents larger than 2Gi characters on 64-bit platforms.

Pick-to: 6.3 6.2
Fixes: QTBUG-102466
Change-Id: Ie48274190ac359f62d3ec3d8fe60eb43cc2c362a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-13 01:16:22 +02:00
Morten Johan Sørvig
d99e8d96b6 wasm: make rasterwindow use non-deprecated API
Pick-to: 6.3
Change-Id: I17f2c9517cb8b8e7103fc40068580f953ceb6aff
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-04-12 19:33:35 +01:00
Giuseppe D'Angelo
69555b364d QTimeZone: add construction from std::chrono::time_zone*
A time_zone represents a timezone identified by its IANA ID. This
allows for a straightforward conversion to QTimeZone.

[ChangeLog][QtCore][QTimeZone] QTimeZone can now be constructed
from a std::chrono::time_zone pointer.

Change-Id: I093d9fc2e989475d30730a9dcdef491903a2aeb2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-12 20:26:55 +02:00
Shawn Rutledge
21ceefacdf QImageReader::read(): fetch filename once
The code in the Q_TRACE_ENABLED case was doing the same sort of
qobject_cast that is done in the fileName() accessor; so it's both a
code deduplication and an optimization to get the filename into a
local variable once, and use it both for tracing and for the
@Nx suffix check below.

Task-number: QTBUG-100578
Change-Id: Id7bde4ddbab38e20694c09cc7b412fec091672de
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-04-12 18:26:55 +00:00
Assam Boudjelthia
2da00bfc3a Android: Don't assert in add/removeWindow
No need to assert, returning when the window is already added or not
removed is enough.

Pick-to: 6.2 6.3
Fixes: QTBUG-100173
Change-Id: Id491f17612ce42c4e26e9d41ad38f0a6372775bd
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-04-12 18:21:02 +00:00
Morten Johan Sørvig
ed7666903b wasm: fix qstweb::EventCallback destructor
Make ~EventCallback() not clear properties belonging to
other EventCallback instances.

This fixes File::stream(), which creates a new EventCallback
before deleting the old one when updating the callback
function.

Pick-to: 6.3
Change-Id: Ib5f78ccc4158d94e8d3f5b9ebb9979c123b1966a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-04-12 15:40:47 +02:00
Assam Boudjelthia
0742e5770b Android: wrap QAndroidInputContext's m_focusObject in a QPointer
To make sure we don't end up use a dangling pointer for m_focusObject.

Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-102447
Change-Id: I75058040be109a39f830bc706efe85969ffbc8ec
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-12 12:53:28 +03:00
Sona Kurazyan
9662c7da8f QtDBus: replace remaining uses of QLatin1String with QLatin1StringView
Task-number: QTBUG-98434
Change-Id: I733af3126f126e5025f709cfe023b9f6bbc13e3e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-12 11:48:08 +02:00
Sona Kurazyan
e9e43bff29 QtDBus: use _L1 for for creating Latin-1 string literals
Task-number: QTBUG-98434
Change-Id: I99d9a82c77d00124ea8953b98406959f1bf9413a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-12 11:48:08 +02:00
Sona Kurazyan
6e77d2a10c QtDBus: stop using QLatin1Char constructor for creating char literals
Required for porting away from QLatin1Char/QLatin1String in scope of
QTBUG-98434.

Change-Id: I48e2946c4cc8d0a6c3e0cc37e1f73510b878d574
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-12 11:48:07 +02:00
Joerg Bornemann
2c364aef4c Remove the qmake2cmake wrapper scripts and document where they are
Pick-to: 6.3
Change-Id: Ib36f4e614845a3b375f4a86239fa7e6e26d7adea
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-12 10:34:40 +02:00
Alexey Edelev
8eef32d460 Suppress cmake warning about empty string argument
When generating .pc files there is a warning when executing
QtFinishPkgConfigFile.cmake:

  Ignoring empty string ("") provided on the command line.

This happens because the 'postfix' argument is a part of the script
command line even if it's empty. It also makes no sense to check if
'postfix' is empty using genex, use configuring-time check instead.

Pick-to: 6.2 6.3
Change-Id: If52d9634f4885caefb828976b3c99592a6db3d3c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-04-12 04:57:14 +00:00
Dimitrios Apostolou
b8677bd31f Fix use-after-free because QByteArray::data() was copying data
Previously there was a mixture of buf.constData() and buf.data() with
buf not being const QByteArray. As a result, buf.data() returned a
re-allocated buffer and texData was keeping pointers to that one, which
became invalid once the function returned and the re-allocated buffer
was cleaned up by destructor.

Change buf to const QByteArray so that there is no difference between
data() and constData(). Additionally convert all constData() calls to
data() to avoid confusion.

Detected by Address Sanitizer on testcase
  tst_qtexturefilereader::checkMetadata()

Pick-to: 6.3 6.2
Change-Id: Idb6f6141898678bf95ed9233a92b7bb3ad12e250
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-04-12 00:48:17 +02:00
Dimitrios Apostolou
f9f1085735 Skip test that fails with Address Sanitizer enabled
These particular testcases request huge buffers from malloc() .This is
intentional and the test expects malloc() to return NULL. Address
sanitizer catches this and considers it a problem.

Could also be skipped in runtime by setting the environment variable:

  ASAN_OPTIONS=allocator_may_return_null=1

Task-number: QTBUG-89400
Change-Id: Id3a9b586be9c0bad4a007e1731f2bc1a879cc76e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-04-12 00:48:17 +02:00