Commit Graph

51836 Commits

Author SHA1 Message Date
Xiao YaoBing
135dbdb553 Partially modified to use C++11 standard nullptr
Change-Id: Ibfd76357ceb56b347afe7122fc252b866b21cb11
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-05-27 03:24:40 +08:00
Tor Arne Vestbø
7f4ec4ed88 Blacklist tst_QTcpServer::linkLocal on macOS ARM
Amends d790e9fda9.

Change-Id: If17a9e2f3f9858c0850006f48242248c4b812e27
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-26 21:24:40 +02:00
Alexandru Croitor
6dd1b66517 CMake: Don't apply invalid infixes to INTERFACE libraries
And object libraries.

Setting properties like IMPORT_SUFFIX on them doesn't make sense and
can cause configuration issues.

Amends 1bd408d6f7

Change-Id: Ie91d1fbc7ba130816854d50c5b00ef793e4bad1f
Reviewed-by: Martin Storsjö <martin@martin.st>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-26 20:37:21 +02:00
Allan Sandfeld Jensen
93cd9130d6 Introduce float QImage formats and rendering
Useful for some HDR representations and HDR rendering.

Change-Id: If6e8a661faa3d2afdf17b6ed4d8ff5c5b2aeb30e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-05-26 18:00:01 +02:00
Edward Welbourne
e51831260a Nomenclature change: s/countr/territor/g in locale scripts
Change the nomenclature used in the scripts and the QLocaleXML data
format to use "territory" and "territories" in place of "country" and
"countries". Does not change the generated source files.

Change-Id: I4b208d8d01ad2bfc70d289fa6551f7e0355df5ef
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-26 18:00:01 +02:00
Edward Welbourne
21e0ef3ccf Rename util/locale_database/enumdata.py's various *_list to *_map
These variables provide mappings, not lists, so name them non-deceptively.

Change-Id: Idf15e78ad73790bc86dd8b9d4f248d1c4f73993c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-05-26 18:00:01 +02:00
Edward Welbourne
181424d9b5 QLocaleXmlWriter.enumData(): move enumdata import to method from caller
The only reason cldr.py imported enumdata was so as to pass what it
imported to writer.enumData(); that method might as well do the import
itself.

Change-Id: Ie77dcd29058f926b8cca4deef35837f30505859f
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-05-26 18:00:01 +02:00
Edward Welbourne
451500f8f8 Check for overflow in QDateTime::setMSecsSinceEpoch()
When adding an offset from UTC, arithmetic may overflow.  Likewise
when combining a date and time (that have been offset for UTC).  Also
check the return from epochMSecsToLocalTime(), as it can fail; and pay
attention to the status stored by setDateTime(), to notice when it
hits an overflow. Fixed some tests that only passed because we
neglected these checks. Extended a test to check we detect overflow in
a couple of cases close to the extremes.

Change-Id: I127a670302f94a07bb9b087b1b9c608b7c08785c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-26 18:00:01 +02:00
Edward Welbourne
fc6629b6bb Harmonize zoneMSecsToEpochMSecs() and localMSecsToEpochMSecs()
Now that the latter calls the former in its fall-back, this saves that
call the need to follow up with determining DST and abbreviation. This
also lets refreshZonedDateTime() update its DST guess for timezones as
well as for local time.

Change-Id: I820b65c1d6db78619defe2af5e947cb98ae336f0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-26 18:00:01 +02:00
Edward Welbourne
35412acd88 Use time-zone transition data before 1970 as well as after
QDateTime has long followed a convention of ignoring what it knows
about time-zone transitions before the epoch. This produces unhelpful
artefacts (such as an ahistorical spring-forward skipping the first
hour of 1970 in Europe/London, which was in permanent DST at the time)
and complicates the code. It documented that DST transitions were
ignored, but in fact ignored all transitions prior to 1970 and simply
assumed that the current time-zone properties (half a century later)
applied to all times before 1970.

This appears to be based on the fact that the MS APIs using time_t all
limit their range to after 1970. Given that we have to resort to
"other means" to deal with times after the end of time_t, when it's
only 32-bit (and after year 3000, on MS systems), we have the means in
place to handle times outside the range supported by the system APIs,
so have no need to mimic this restriction. (Those means are not as
robust as we might want, but they are less bad than assuming that the
present zone properites were always in effect prior to 1970.) On
macOS, the time_t functions only reach back to the start of 1900; it
reaches to the end of its time_t range and Linux covers the whole
range. Given this variety, the range is now auto-detected the first
time it is needed (based on some quick and dirty heuristics).

Various CET-specific tests now need adjustments in tests of times
before the introduction of time-zones (when they are in fact on LMT,
not CET). The systemZone() test of QTimeZone can now restore its
pre-zone test cases. Various comments on tests needed updates.

[ChangeLog][QtCore][QDateTime] Available time-zone information is now
used to its full extent, where previously QDateTime used LocalTime's
current standard time for all dates before 1970. Where we have
time-zone information, it is considered reliable, so we use it.  This
changes the "best efforts" used for times outside the range supported
by the system APIs, in most cases giving less misleading results.

Fixes: QTBUG-80421
Change-Id: I7b1df7622dd9be244b0238ed9c08845fb5b32215
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-26 18:00:01 +02:00
Craig Scott
d97fd7af2b Build examples in isolated sub-builds using ExternalProject
Examples are intended to show how to build against an installed Qt.
Building them as part of the main build means the way the Qt targets
are defined and created are not representative of an end user's build.
By building them as separate projects using ExternalProject, we can
more closely replicate the intended audience's environment. This
should allow us to catch more problems earlier.

Having examples built as part of the main build also creates problems
with some static builds where a tool built by the main build is needed
during configure time. This happens with other repos like qtdeclarative
but not (currently) with qtbase. Converting the examples in qtbase to
be built using ExternalProject is intended as a demonstrator for how
other repos can do similar. Until other repos are converted, they will
continue to work as they did before, with examples as part of the main
build for non-static builds only.

The new build-externally behavior is only supported for non-prefix
builds with this change. Prefix builds will continue to use the old
non-external method. Support for building examples externally in
prefix builds will be a separate change.

Task-number: QTBUG-90820
Fixes: QTBUG-91068
Change-Id: I2304329940568dbdb7da18d54d5595ea7d8668bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-26 13:33:29 +02:00
Mårten Nordheim
9b5fadb9f8 Android: fix missing include
qtbase/include/QtCore/../../../../src/qtbase/src/corelib/kernel/qcoreapplication_platform.h:58:57: error: unknown type name 'QCoreApplication'
    QT_DECLARE_NATIVE_INTERFACE(QAndroidApplication, 1, QCoreApplication)

Change-Id: I0a14a2f2ab80f9cc0e7fd3b3060719a1c772bf57
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-26 13:28:44 +02:00
Andreas Buhr
7d760480c0 Initialize SYSTEMTIME to {} instead of memset()ing
Change-Id: I7ee02a6bcf5961adce26b635f12722e12c4865d3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-26 13:08:09 +02:00
Paul Wicking
a1dfe27955 Doc: Use \deprecated instead of \obsolete
Task-number: QTBUG-93990
Change-Id: I4e512354a49dde6678ca89cabc56bc76ba666bb3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-26 13:06:56 +02:00
Friedemann Kleint
ae02188233 QTestlib: Add formatting for QObject * in QCOMPARE
Output object name and class in QCOMPARE(). This should help
to debug flaky QWidget tests that for example check on focusWidget().

[ChangeLog][QtTestLib] QCOMPARE() now reports QObject * values by class and objectName().

Task-number: QTBUG-64446
Change-Id: Ife04e89bba04fc78d077c8f0f07af17a17c9cf8c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-26 11:02:48 +00:00
Aleksei Nikiforov
25a7034d78 Qt xcb: remove false detects of Qt::GroupSwitchModifier
In some cases, if X11 is configured with CapsLock as
keyboard language switch key, and CapsLock is toggled
via Shift+CapsLock key combination,
toggled CapsLock is falsely detected as Qt::GroupSwitchModifier
for subsequent key events.

This change fixes this false detect,
but doesn't fix detection of Qt::GroupSwitchModifier
which is likely still broken.

Fixes: QTBUG-49771
Pick-to: 5.15 6.0 6.1
Change-Id: I485e2d4f3c654707c62adaba367c1b8afb3fc36c
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-05-26 11:02:08 +00:00
Tor Arne Vestbø
d790e9fda9 Blacklist problematic network auto-tests on macOS ARM
QNetworkInterface reports as up and running an interface,
seemingly having a valid IP address which actually has
not IPv4/IPv6 configured at all (this is what getifaddrs
gives us).

Change-Id: I5808d5dfdbc54004a1e02b791917e9b2ba62905f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-26 12:49:56 +02:00
Giuseppe D'Angelo
4b60cea602 Farewell Q_DISABLE_MOVE
In hindsight, this macro is an API mistake, as it should NEVER be used
alone, but always in combination with Q_DISABLE_COPY. But in that case,
there's a better macro: Q_DISABLE_COPY_MOVE; hence this API is either
bad, or completely redundant.

A GitHub search reveals that luckily there's a handful of usages in the
wild (of which 0 in Qt/dev and KDE). Hence, I'm going for the kill, and
removing it entirely.

[ChangeLog][Source-Incompatible Changes][QtGlobal] The Q_DISABLE_MOVE
macro has been removed. Code that was using it can be ported to
Q_DISABLE_COPY_MOVE instead.

Change-Id: I7e346f7e2288f3f5a45315f4f6bfaeb2661f1de5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-05-26 03:14:52 +02:00
Tor Arne Vestbø
f20edffcc8 testlib: Disable automatic backtrace when test crashes on macOS on ARM
The trick we use by spawning lldb to print the backtrace doesn't work
for some reason, and just results in:

    Process 91619 stopped
    * thread #1, stop reason = signal SIGSTOP
        frame #0: 0xffffffffffffffff
    Target 0: (No executable module.) stopped.

    Architecture set to: .
    (lldb) bt all
    * thread #1, stop reason = signal SIGSTOP
      frame #0: 0xffffffffffffffff
      thread #2
        frame #0: 0xffffffffffffffff
      thread #3
        frame #0: 0xffffffffffffffff
      thread #4
        frame #0: 0xffffffffffffffff

Debugging the stopped process manually with lldb works fine.

Change-Id: If5582803a11f1c5c84c31b42d1ae52bdd245bbbb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-26 03:14:52 +02:00
Tor Arne Vestbø
d4cff8c537 Fix wrong variable initialization in tst_QScrollBar::task_209492
Change-Id: Icf1f6da46caa7fb7f3bd308eaaf4e037af814d17
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-26 03:14:52 +02:00
Edward Welbourne
55765898fe Initialize SYSTEMTIME to {} instead of memset()ing
Change-Id: Ic17b90d10d6b5b7f4610e904e18979fc1d658a0a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-25 22:55:14 +02:00
Fabian Kosmale
e16afd66fc gcc 11: Adjust pragma warning placement
Apparently, gcc's pragma warning logic has changed from 10 -> 11. For
gcc 11, we need to place the macro directly next to the the line which
triggers the warning.

Task-number: QTBUG-93360
Pick-to: 6.1
Change-Id: Ifaa6136050fe5b887660a8a0acf6938388f4f77d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-25 22:54:55 +02:00
Alexandru Croitor
c3c8b7083a CMake: Remove some dead installation code
It was copy-pasted (presumably from plugin handling code)
when initially introduced but was never used.

Change-Id: I571738b9f5269ca038f5931a773aa5c2c66aafbc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-25 22:36:56 +02:00
Alexandru Croitor
1bd408d6f7 CMake: Introduce a public qt_add_library function
Internally it uses a new _qt_internal_add_library function (similar
how we have qt_add_executable and _qt_internal_add_executable) as well
as finalizer code line the executable case.

_qt_internal_add_library forwards arguments to add_library with some
Qt specific adjustments to the selected default target type (based on
whether Qt is configured as static or shared).

The new _qt_internal_add_library is now used in qt_add_plugin as well
as some internal library creating functions like
qt_internal_add_module.

This reduces some duplication of file name adjustments across
functions and creates a central point for creation of Qt-like
libraries (for some definition of Qt-like).

Change-Id: Id9a31fe6bf278c8c3bb1e61e00a9febf7f1a2664
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-25 22:36:53 +02:00
Fabian Kosmale
5e96c64afb QSharedPointer: Use matching new/delete
When a weak pointer calls getAndRef and there is no strong reference
yet, getAndRef creates a new ExternalRefCountData. Normally,
ExternalRefCountData is never constructed directly, only its subclasses
are constructed via placement new into a memory buffer.
To that end, ExternalRefCountData has a custom operator delete, which
calls the global operator delete (do deallocate the memory buffer
correctly).
When using operator new directly in getAndRef, gcc notices a new/delete
mismatch with the delete in the same function: global operator new
matched with class operator delete. This isn't actually an issue in
practice, as the class operator delete simply calls the global delete.
But to avoid the warning, we can simply call the global operators
explicitly.
To make it clear that allocation of ExternalRefCountData requires some
care, we additionally delete the class operator new, and only allow
placement new (or usage of global operator new, as in getAndRef).

Pick-to: 6.1
Task-number: QTBUG-93360
Change-Id: I132d1e4e07520eadc5b8f3f955c06aecec80c646
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-25 22:23:57 +02:00
Andrey Butirsky
b45b9090c3 qxkbcommon: Map Super/Hyper to Meta early enough to have an effect
Super/Hyper keys are detected during a direct mapping phase, but the
function returned before the translation to Meta could take place.

Task-number: QTBUG-62102
Pick-to: 5.15 6.0 6.1
Change-Id: I9f7ccfd757fa86dbc648951306deb1b43ccf4167
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
2021-05-25 20:02:12 +00:00
Friedemann Kleint
cb881f7c97 uic: Add further widgets to class lib map
It should be possible to use them with promotion.

Task-number: PYSIDE-1404
Change-Id: Idea0ab076c66d2842958eabf66e5dc4f8e1bad3f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-05-25 22:01:56 +02:00
Friedemann Kleint
4b82c1c727 uic: Extract a base class for WriteIncludes
Extract base class WriteIncludesBase from WriteIncludes which
basically adds the dependent classes.
Move the classlibmap there as well.

Task-number: PYSIDE-1404
Change-Id: I899c7818cb96dd3b1af5f328cd20d64fbaf7755b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
2021-05-25 22:01:53 +02:00
Andrey Butirsky
6ecde6265a qxkbcommon: Keep lower case as Qt key when upper case is not in Latin1
Upper-casing a Latin1 character might move it out of Latin1 range,
for example U+00B5 MICRO SIGN, which upper-case equivalent is
U+039C GREEK CAPITAL LETTER MU. If that's the case, then map the
original lower-case character.

Fixes: QTBUG-93858
Pick-to: 5.15 6.0 6.1
Change-Id: Ibd86fbb7c70d620c0884015ec1c40aa6351e6320
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Andrey Butirsky <butirsky@gmail.com>
2021-05-25 15:29:49 +00:00
Xiao YaoBing
6519bcf85d Remove unnecessary type conversion
Change-Id: Ic362f6647d8eaf2004d3bd5e1c6d6411cfb31d86
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-05-25 23:06:17 +08:00
Haoyu Liu
c3804ba061 CMake: fix CMake function qt_commandline_addString
1. a missing '}' breaks CMake
2. the variable "opt" should really be "arg", otherwise it'll be meaningless

Pick-to: 6.1
Change-Id: If29557998bf7aa786dc5c821e2c55f1195e7922b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-25 12:28:32 +00:00
Kimmo Ollila
95c6eb2f2e Add #include <mutex>
Needed for having std::unique_lock

Pick-to: 6.1
Change-Id: I3665e9e2afab0d9230778b8b36f2b7f0c8f44a2a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-05-25 15:28:32 +03:00
Giuseppe D'Angelo
0c7e653ffd QDateTime(Parser): code tidies
Fixup a bunch of QFlags usage that ended up triggering implicit
conversions. These conversions happen because QDateTime tries to save
some space and shove a QFlags value in a bitfield, so there's
no way around them; use explicit conversions instead.

In other places: fix QFlags->bool conversions by using testAnyFlag.

Change-Id: I50e8d92ed829b64ac46097c09e547e1c89cc2e35
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-25 13:38:44 +02:00
Paul Wicking
3bc80defdc Doc: Add missing preposition
Fixes: QTBUG-93969
Pick-to: 6.1
Change-Id: I60e08ab7f17459b6cff969767273228a8406cfc3
Reviewed-by: Johanna Vanhatapio <johanna.vanhatapio@qt.io>
2021-05-25 12:36:09 +02:00
Pekka Gehör
32cdf0ce0f Android: Fix select handles misplacement on QDialog
Get select handles {Left, Right}Point from a mapToGlobal with a cursorRectangleof anchorRectangle
of the selected word/text.

Task-number: QTBUG-90799
Change-Id: I4fed19a1d3bb2247656b052306307e6980074405
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2021-05-25 08:45:39 +03:00
Iikka Eklund
13c8db52a2 Add conanfile.py to support builds with Conan package manager
Initial version of the conanfile.py to support builds with Conan
package manager. Tested with Linux, macOS and Windows desktop
builds first.

Use 'scm' revision_mode so that the revision matches with the git
commit id.

The recipe uses Qt's configure(.bat) and cmake directly,
'conans.CMake' utility tool is not used.

Load options dynamically based on configure(.bat) features:
- configure(.bat) -write-options-for-conan <output file>
  - Expose all usable configure(.bat) options as Conan options
- We want to query configure(.bat) for available options and
  features to avoid duplicating these in multiple places
- The available configure(.bat) option names are formatted to
  suit as dictionary keys in Conan 'options'

The recipe writes 'configure_options.json' and
'configure_features.txt' which are exported as part of the
conan package. This is done only once during the 'conan export'
i.e. when the initial Conan package is being created.
The recipe will reference these files in later phases when needed.

The recipe translates the Qt configure options and features as
Conan options and default_options. When the build is invoked
('conan install') the recipe translates the Conan options back
to suitable Qt configure options which are then passed to
configure(.bat).

Additional cmake flags can be passed via 'extra_cmake_args' option:

  $conan install ... -o extra_cmake_args="-DFOO=bar -DFOO2=bar2"

Remove those options from 'package_id' that point to local environment
like installation paths. These are most probably different on end user
machines making it impossible to re-use the pre-built binaries by Qt CI
as the path values would become of the 'package_id' checksum.

Task-number: QTBUG-92031
Change-Id: I4e47d116fdef6a5daa23aba22bac2b2d74d12c6e
Reviewed-by: Toni Saario <toni.saario@qt.io>
2021-05-24 14:24:34 +03:00
Janne Koskinen
bd31bb4166 Fix compilation for other compilers
Fixes property offset macro compilation issues.

Change-Id: I401a9a35acd1d389c670960edb363a4d919cdb76
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-24 10:18:25 +03:00
Giuseppe D'Angelo
0fecaaec54 QUrl: use QFlags::toInt / qToUnderlying
In preparation for blocking QFlags->int conversions. The existing
casts to uint are wrong, in the general case, as the enumeration
might actually be backed by signed integers; that makes them
fail to compile. Port them to toInt(). For symmetry, also use
qToUnderlying.

Change-Id: I851544f6ba05295fa5f6c5cc355b9de0f1362e2b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-23 21:54:29 +02:00
Thiago Macieira
64bfc927b0 QHash: fix qHash(std::pair)
There were two problems here: first, qHash(std::pair) must be declared
before qHashMulti that might call back to qHash(std::pair) (i.e., a pair
with one element that is also a pair). But moving the declaration above
causes the second problem: the noexcept expression can't refer to qHash
functions that aren't declared yet. So we forward-declare a constexpr
function for that result, but implement it far below.

Fixes: QTBUG-92910
Change-Id: Ia8e48103a54446509e3bfffd16767ed2e29b026c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-23 12:08:43 -07:00
Thiago Macieira
a5ff71578d QRandomGenerator: let qt_initial_random_value() return 128 bits of data
It's how much there is in Linux's AT_RANDOM block.

I've also removed the check for validity. It's highly unlikely that 128
bits are bad.

Change-Id: Id2983978ad544ff79911fffd16723161ea7ec315
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-05-23 12:08:43 -07:00
Thiago Macieira
928ce402a4 QHash & QRandomGenerator: cooperate to provide a simpler initial seed
Instead of initializing the whole QRandomGenerator::system(), which in
turn gets to checking CPUID and whether the HWRNG works, trust the
operating system functions for an initial value. On Linux, we'll use 4
or 8 of the 16 bytes of random data that the kernel populates for us on
AT_RANDOM.

This should make Qt applications not stall on an early system launch
without an RNG daemon, if compiled without getentropy() support. And
avoids silly mistakes causing recursion, like QTBUG-78007 found.

Additionally, qt_random_initial_value() will most likely not throw
either. It's marked noexcept, even though SystemGenerator::fillBuffer
could throw on Linux, if the current thread is canceled, but Linux also
has AT_RANDOM. That leaves the other Unix systems without getentropy()
(read: macOS, since the BSDs have getentropy()).

Fixes: QTBUG-69555
Change-Id: Id2983978ad544ff79911fffd1671fca1a9f9044d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-05-23 12:08:43 -07:00
Thiago Macieira
4ef99b8fbb Deprecate qGlobalQHashSeed and qSetGlobalQHashSeed in Qt 6.6
That's two years from when the replacements were added (6.2).

Change-Id: Id2983978ad544ff79911fffd1671f7dd38fede02
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-05-23 12:08:43 -07:00
Thiago Macieira
a24ced7474 Mark QHashSeed::globalSeed() noexcept
It is noexcept, except when initializing. When initializing, let's just
use qEnvironmentVariableIntValue (which we should have used anyway),
which avoids the memory allocation and is noexcept. The QRandomGenerator
functions are not marked noexcept, but are mostly so: they can't throw
regular exceptions, but some implementations do call POSIX Thread
Cancellation Points, which may cause forced stack unwinding. That's
unlikely to happen at the moment of the QHash initialization.

This is also mitigated in the next commit.

Change-Id: Id2983978ad544ff79911fffd1671fd16f8d6378d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-05-23 12:08:42 -07:00
Thiago Macieira
7ac0621ad1 Introduce QHashSeed and switch to size_t seeds
Commit 37e0953613 added a to-do, but we
can actually change the type, since we've documented since Qt 5.10 that
setting a non-zero value (aside from -1) with qSetGlobalQHashSeed was
not allowed. Storing a value to be reset later is simply not supported.

Change-Id: Id2983978ad544ff79911fffd1671f7b5de284bab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-05-23 12:08:42 -07:00
Alexey Edelev
ffe5f92546 Add _qt_module_interface_name for 3rdparty libraries
Since we add 3rdparty libraries to the set of the Qt modules, they are
treated as the Qt modules by the depenedcy helper as well. So give them
_qt_module_interface_name to fix dependency helper.

Amends 425ff34aa1

Change-Id: I5898c1c90156de1878aeeef5a0924349b44c50fa
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-05-23 16:16:09 +02:00
Alex Trotsenko
76bd873030 QProcess/Unix: fix build in debug mode
qprocess_unix.cpp:633:55: error: ‘i’ was not declared in this scope

Change-Id: I152fbd9df6e9d3f31e2c2c8b23a3c1ab87aa237a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-23 16:04:57 +03:00
Mårten Nordheim
6725f0f77d Attributions: Don't mention QT_CRYPTOGRAPHICHASH_ONLY_SHA1
It's only meant for bootstrap builds.
Considering that SHA1 is deprecated by NIST we should not artificially
limit ourselves to using only that.

Task-number: QTBUG-93838
Change-Id: Ib779ad4e4349cfdc71d797eb3ba5ccfb7747e933
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-23 11:47:42 +00:00
Fabian Kosmale
3f7741000c QTestAccessible: Clear objects in EventList when deleted
The list persists events, which reference objects. Those objects might
get deleted by the time we investigate the objects. We cannot change the
event to store a QPointer for BIC reasons, and for normal usage of the
events, that doesn't make sense either.
Instead, connect the objects destroyed signal to a lambda which clears
the events' object member.
In order to access the private member, we befriend the test class.

Change-Id: I036be7053dccde4bdf862173789564e89d729ee1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-05-23 10:46:03 +00:00
Nodir Temirkhodjaev
ffde36c9a3 qcborstreamreader.cpp: Use QT_TRY/QT_CATCH
To avoid build error with no exceptions:
qtbase/src/corelib/serialization/qcborstreamreader.cpp:1586:9: error: cannot use 'try' with exceptions disabled
        try {
        ^
qtbase/src/corelib/serialization/qcborstreamreader.cpp:1629:9: error: cannot use 'try' with exceptions disabled
        try {
        ^
2 errors generated.

Used compiler: https://github.com/mstorsjo/llvm-mingw

It's not a supported configuration, but the change is simple.

Change-Id: I263ce23b458f114b2330e832c5f4fd2a99cbb973
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-05-23 09:22:04 +00:00
Li Xinwei
19bb9837a1 Skip building debug bootstrap lib for CMake 3.20 and multi-config build
When building qtbase with CMake 3.20, only release tools will be built
by default in a multi-config build, so it is possible to skip building
debug bootstrap lib.

Task-number: QTBUG-88414
Change-Id: I266ac458ae3c89c593656e4ebdc788ae5797b788
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-23 14:00:53 +08:00