Commit Graph

52129 Commits

Author SHA1 Message Date
Alexandru Croitor
e2c6f2ba7e CMake: Fix 'Cannot find source file' error with older CMakes
Configuring a static qtdeclarative with CMake versions older than
3.18.0 fails at generation phase with

CMake Error at cmake/QtExecutableHelpers.cmake:28 (add_executable):
  Cannot find source file:

   some_path/some_target_plugin_imports_Gui.cpp

Marking the generated file as GENERATED explicitly solves the issue.

Pick-to: 6.1 6.2
Change-Id: Ife0eba61a1aab4f988d9fe7e2217d30eb96774a7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-25 12:33:58 +02:00
Alexandru Croitor
1981682687 CMake: Propagate sanitizer flags to public projects
Ensure that Qt user projects build with sanitizer flags if Qt was
configured with any of the sanitizers enabled.

To compile Qt with sanitizer support enable any of Qt sanitizer
features.

Passing -DECM_ENABLE_SANITIZERS=address to CMake is NOT supported
anymore.

When configuring Qt using CMake directly, pass
    -DFEATURE_sanitizer_address=ON
    -DFEATURE_sanitizer_undefined=ON
instead of
    -DECM_ENABLE_SANITIZERS=address;undefined

When configuring Qt with the configure script pass
    -sanitize address -sanitize undefined
as usual.

QtConfig.cmake now records the sanitizer options that should be
enabled for all consuming projects based on the enabled Qt features.
This applies to internal Qt builds as well as well as tests an
examples.

The recorded sanitizer options are assigned to the ECM_ENABLE_SANITIZERS
variable in the directory scope where find_package(Qt6) is called.
The ECMEnableSanitizers module is included to add the necessary flags to
all targets in that directory scope or its children.

This behavior can be opted out by setting the
QT_NO_ADD_SANITIZER_OPTIONS variable in projects that use Qt and might
be handling sanitizer options differently.

Amends 7e03bc39b8

Pick-to: 6.2
Fixes: QTBUG-87989
Task-number: QTBUG-92083
Change-Id: I2e3371147277bdf8f55a39abaa34478dea4853a6
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-25 12:33:58 +02:00
Alexandru Croitor
9a9da3aad2 CMake: Handle fuzzer-no-link sanitizer feature name correctly
Pick-to: 6.2
Task-number: QTBUG-87989
Change-Id: Ife42f1fe001c5fafd10981f23dcd387cacc15276
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-25 12:33:58 +02:00
Alexandru Croitor
8c1a35a991 CMake: Restore Qt-custom sanitizer additions to ECMEnableSanitizers
Restores addition of 'float-divide-by-zero' to undefined sanitizer
flags as well as the custom fuzzer-no-link option.

Pick-to: 6.2
Task-number: QTBUG-87989
Change-Id: Icde1e5d31083ce1b6128ab45b0e9df5ae69736a3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-25 12:33:58 +02:00
Alexandru Croitor
6b3e512e02 CMake: Update ECM sanitizer module to latest version
To bring support for sanitizers when using MSVC.

Pick-to: 6.2
Task-number: QTBUG-87989
Change-Id: I7a8ebf8fdaa31669df82d232fd9eae4e72407b92
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-25 12:33:58 +02:00
Timur Pocheptsov
f7f2582c60 tst_qsslsocket: detect ALPN support (on server) using supportedFeatures()
Pick-to: 6.2
Change-Id: I30409667395bbe568823b8697dded41067a8346c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-25 08:01:55 +02:00
Mårten Nordheim
43a36dfd81 Schannel: Get rid of Windows < 10 code
No need to check if we're running on windows 8.1 or above.
We always are.

Pick-to: 6.2
Change-Id: I9f2e7a58631064e573725705882a603e900c7e39
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-25 06:01:54 +00:00
Mårten Nordheim
773b37fb38 tst_QSslSocket: Use supportedFeatures() instead of macro
It needs to be checked at runtime to know if the current backend
supports it

Pick-to: 6.2
Change-Id: I0998309149b109e2075a008b2b8d8115fa3688cc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-24 23:30:47 +00:00
Mårten Nordheim
edc9a294a6 qopenssl_symbols: Change how we mark function unused
With MSVC the current way we mark it (potentially) unused ends up with a
warning:
warning C4551: function call missing argument list

We require c++17 core language support so let's use [[maybe_unused]]
instead.

Pick-to: 6.2
Change-Id: I125986b729cb7cd540901702a47365f0491e7887
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-24 23:30:47 +00:00
Mårten Nordheim
8b4fa1774e QTlsBackend: Find mismatches faster in ciphersuite-string creation
Change-Id: I5744fc3673e8d318b8dd859a281ed0e766649578
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-25 01:30:47 +02:00
Mårten Nordheim
bb93c641a2 TLS: Mark TLS 1.0, 1.1 and DTLS 1.0 deprecated
As per the best practice laid forth in RFC-8996.
TLS 1.2 was recommended from 2008 until TLS 1.3 was released in 2018.

[ChangeLog][QtNetwork][QSslSocket] TLS 1.0, 1.1 and DTLS 1.0 are now
deprecated, as recommended by RFC-8996.

Fixes: QTBUG-92880
Change-Id: I90cebcfb07cfce623af7ac9f2b66ce9d02586b54
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-25 01:30:46 +02:00
Mårten Nordheim
664a6621fb QSslSocket: Set isEncrypted to false on disconnect
Since we're no longer connected, much less encrypted.
Was done in schannel backend, but not in ST or OpenSSL

Pick-to: 6.2
Change-Id: Ia49387be0088f899a0c89091f7e468dba1c0eee6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-25 01:30:46 +02:00
Andreas Buhr
1587d75b5e Consistent indentation for all Q_PROPERTYs
Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I8c97a0b2de2bed78456322be271724fc47479d83
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-24 23:06:20 +02:00
Mårten Nordheim
def3cad087 Schannel: fix compilation with QSSLSOCKET_DEBUG
Small leftover mistake

Change-Id: I0cb55fe78a2666665a3c56b41200c127a42df0c2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-06-24 23:06:20 +02:00
Timur Pocheptsov
13ce568b76 tst_http2: use the supportedFeatures() instead of macros
With the recent change, 'system' headers gone: not in the test code anymore,
so, for example OPENSSL_VERSION_NUMBER is undefined, making the test
to select a wrong code-path - 'h2c', instead of encrypted h2.

Pick-to: 6.2
Pick-to: 6.1
Change-Id: I3b201e21fac56875c9045c7463e2ae69af4c6470
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-24 21:35:58 +02:00
Alexey Edelev
d705d7e5d6 Migrate to autogenerated cpp exports
Use autogeneratedd cpp exports in the Gui module.

Task-number: QTBUG-90492
Change-Id: Ifc5d3dd138ef9f86f6003ed9adb66a9eefdd64db
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-24 20:40:49 +02:00
Alexey Edelev
9bd418aeab Implement generating of a module cpp export header
Add an option that automatically generates an export header for a Qt
module. The header contains only Q_DECL_EXPORT/Q_DECL_IMPORT related
content, so it's not a full replacement of 'global' header files.

Task-number: QTBUG-90492
Change-Id: I250d1201b11d4096b7e78e61cbf4565945fe6517
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-24 20:40:49 +02:00
Andreas Buhr
4b850065b1 Consistent indentation for BINDABLE properties
Triggered by API review in Gerrit patch 355960.

Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I7cafc1cc9d4b929040b53c6bf92c91d73c3b39f2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-24 19:35:29 +02:00
Alexey Edelev
1cb63fcc97 Disable forced full optimization if QT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS=ON
Pick-to: 6.2
Task-number: QTBUG-94753
Change-Id: Ib9dda1a96f3123394e3b3d4f84feac8cedd18b89
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-24 18:10:32 +02:00
Tang Haixiang
7311cdc0d2 xcb: fix cursorTheme update issue
Clear the cache when cursor theme changed.

Idealy we should subscribe root window's RESOURCE_MANAGER property
to update cursor theme via Xcursor. KDE already has a daemon
KDE GTK Configurator to sync KDE settings to GTK. Then we can
register the fallback there both for KDE and GTK changes. See also
https://invent.kde.org/plasma/kde-gtk-config

Fixes: QTBUG-94538
Pick-to: 6.2 6.1 6.0 5.15
Change-Id: Ia4de30930a0dc1dc306c61e1553970c3dab67bd6
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-06-24 17:42:42 +02:00
Andreas Buhr
fa664e0b2a Remove const from signal
We made a signal const. This does not make sense.

Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I372da9c045ba880f8fba48399e441b53c1683e93
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-24 16:37:46 +02:00
Edward Welbourne
b3deb6a161 Expand a test that QVariant isn't null even when what it wraps is
Match the checks in the constructor test that are similar.

Change-Id: Ifb62af09e31aac339f001f44bc30789330c85be6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-24 16:35:41 +02:00
Volker Hilsheimer
5edb27c9f5 Put SVG versions of several built-in icons under version control
This is a collection of SVGs provided in the process of addressing
QTBUG-38776. As of now, they are converted to PNGs or XPMs in different
resolutions, which are then built into Qt as resources that are loaded
into QIcon instances at runtime.

Task-number: QTBUG-38776
Change-Id: Ib03f82cf1b1d2dc6260845fc46ad193046aff44c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-24 12:57:30 +02:00
Volker Hilsheimer
b278a4f9b0 Use On icon for pressed dock widget title buttons without frame
The QCommonStyle provides explicit pixmaps for the SP_TitleBarCloseButton
and SP_TitleBarNormalButton, but never showed the "down" pixmap on macOS
because the button has no frame, so the On state flag was never set.

Set the style states so that the "down" pixmap is used on a button that
is either pressed or checked if it doesn't have a frame. Since QIcon
only has two states, use the "On" state for both pressed and checked.

Pick-to: 6.2
Task-number: QTBUG-38776
Change-Id: Ic04070196b97a4fb66d7a2669e9894fd7960230e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-24 12:57:21 +02:00
Thiago Macieira
8b882f42e8 SCTP: fix qsizetype miss
Found by clang 12:
qsctpsocket.cpp:172:56: error: result of comparison of constant 9223372036854775782 with expression of type 'int' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
            Q_ASSERT((datagramSize + int(bytesToRead)) < MaxByteArraySize);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~

Change-Id: I7246c3e7bb894e0d9521fffd168af11764956d8f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-23 13:43:26 -07:00
Joerg Bornemann
d6e01ae05c Fix QT_HOST_DATA for builds setting INSTALL_MKSPECSDIR
In a Qt build that was configured with INSTALL_MKSPECSDIR set to
something different than INSTALL_DATADIR, the qmake property
QT_HOST_DATA was wrong. Consequently, mkspecs could not be loaded,
rendering qmake dysfunctional.

The reason was that we considered every QT_HOST_xxx property to have the
same value as QT_INSTALL_xxx in a non-cross build.
This is not true for QT_HOST_DATA, because users might want to set
INSTALL_DATADIR to "foo" but INSTALL_MKSPECSDIR to "bar/mkspecs".

Move the unused determination of the host data dir to the QtLibraryInfo
lib and handle QT_HOST_DATA specially.

Fixes: QTBUG-94591
Pick-to: 6.2
Change-Id: I2c44cda8405ff1d14391254fcd1d9b1361cb5855
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-23 22:12:41 +02:00
Paul Wicking
cc2fdce35e Extend documentation for QFile:copy()
- Add information about symlinks and file metadata.
- Reflow text.
- Extract text common to both overloads to a .qdocinc file
  for consistency and to avoid duplication.

Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-94706
Change-Id: I3c730fd63f4018a1a573bb56751fedd2270a3247
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 20:09:46 +02:00
Fabian Kosmale
cbe65673b2 QObject::disconnect: remove dead code
Change-Id: Id82ee3d0fb04d89e498cf05d0c0be33c4fe03e86
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 16:35:06 +02:00
Volker Hilsheimer
85121af2eb Fix compiler warning from unused parameter
Change-Id: I227b7188eddbad024dcced908c894925cee56591
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-23 15:06:33 +02:00
Alexey Edelev
1c2ca4004d Fix invalid path to the qt-cmake.bat when calling qt-internal-configure-tests.bat
Since qt-internal-configure-tests.bat is located in the same folder as
qt-cmake.bat the relative_path_from_libexec_dir_to_bin_dir is empty.

Passing doubled backslash in the windows path causes an issue for the
cmd.exe batch interpreter. Extra backslashes are treated by %~dp0 as a
start of the relative path. The following error appears:

   Could not find toolchain file:
     ...\install\bin\..\/../lib/cmake/Qt6/qt.toolchain.cmake

This appends an extra backslash to relative_bin_dir only if
relative_path_from_libexec_dir_to_bin_dir is not empty.

Change-Id: Id2fd6c5fa9d73060350f298262c6e93a4887eeb3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-23 14:26:18 +02:00
Edward Welbourne
c00ee2f310 Use UTC when parsing only a date or only a time, not a date-time
This should reduce the amount of fall-out from DST complications.
Also document the assumptions of QDateTimeParser's two fromString()
methods (and fix the punctuation on the QDateTime parameter).
Adjusted some tests to match.

Since only QDateTime-returning methods will show the difference, and
it's at least somewhat odd to be using those on QDateEdit or
QTimeEdit, this should have little impact on API users.

[ChangeLog][QtCore][Behavior Change] QDateEdit and QTimeEdit now
operate in UTC, to avoid spurious complications arising from time-zone
transitions (e.g. DST) causing the implicit other half to combine with
the part being edited to make an invalid result. Returns from their
dateTime() and other methods returning QDateTime (max/min) shall thus
be in UTC where previously they were in local time. QDateTimeEdit
continues using local time. The default can be over-ridden by
setTimeSpec(), as ever.

Change-Id: I44fece004c12342fe536bbe3048217d236fd97b2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 14:04:08 +02:00
Edward Welbourne
5ad13ec57d Fix coding-style violation in QUtf8StringView::operator==()
Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I00a9c14963fe8f8d1b524350aec5544ff5dd609c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 14:04:08 +02:00
Edward Welbourne
ccac1b185a Rename PermisionType to spell permission correctly
Thanks to Giuseppe for pointing it out in API change review.

Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: I3b8fb653b5efa7ded51f81aadb35d361e7dbf19c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-06-23 14:04:08 +02:00
Edward Welbourne
9625c744a9 Coding style: remove redundant braces, break long line
Task-number: QTBUG-94407
Pick-to: 6.2
Change-Id: Id9bbc3871bc3350fa5cc656f4248de8e6511ff05
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-23 14:04:08 +02:00
Edward Welbourne
d093ec8d03 Fix handling of day-of-week in QDateTimeParser and QDateTimeEdit
QDTP's absoluteMax(), setDigit() and getDigit() simply treated
day-of-week as synonym for day-of-month.
Consequently, QDTE::stepBy() did the same.

This meant that wrapping happened at the month boundary, so would jump
within the week if it wrapped around, otherwise the up/down arrow
would "jam" at a particular day of the week when further steps would
leave the month. Instead, when wrapping, wrap round the week while
still moving the day-of-month to match, jumping back or forward a week
to stay within the month on hitting a month boundary; otherwise, stop
backwards stepping on hitting the locale-specific day of the week, or
forward stepping when the step would be to or past this first day.
Fixed various bugs found in the course of testing this.

[ChangeLog][QtWidgets][QDateTimeEdit] Corrected handling of weekdays.
Previously, changes to the week-day were simply changes to the day of
the month. Weekday fields are now handled as such: changes to them do
change the day of the month, but a change that would step past the end
(or start) of the month is adjusted to the relevant day of the nearest
week within the month. When wrapping is disabled, the locale-specific
first and last days of the week are the bounds. Formats which specify
day of week but not day of month will now preserve day of week when
changing month or year, selecting the nearest day of month that
matches.

Change-Id: I7868b000fea7a4bc17a1b5687c44bcd56d42ae90
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-23 14:04:08 +02:00
Tor Arne Vestbø
b0a9825edb macOS: Respect QMAKE_APPLE_DEVICE_ARCHS by building for all those archs
If QMAKE_APPLE_DEVICE_ARCHS is not set, we pick up the available archs
based on what Qt was built with (QT_ARCS), but only build the active
arch.

Pick-to: 6.2
Change-Id: I83273f878022af34a3a0d0eeae8b11d781f78c49
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-23 13:43:45 +02:00
Tor Arne Vestbø
96469ae338 macOS: Unregister screen notification handlers on QGuiApplication shutdown
In the case of a plugin, the plugin might be unloaded, and destroy its
QGuiApplication. We don't want the screen notification handlers to outlive
the application, as that results in crashes.

Fixes: QTBUG-91919
Pick-to: 6.2 6.1 5.15
Done-with: Yang Yang
Change-Id: I3a4c0fcf97b785357516d1dac34489511400f154
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-23 13:43:45 +02:00
Kai Köhne
d0676874d6 MSVC: Enable warnings-are-errors for latest Visual Studio 2019
Also remove handling of older versions, because we only support
Visual Studio 2019 currently

Pick-to: 6.2
Change-Id: If66a46d970047fe25582e323df74e0a904ee92da
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-06-23 12:49:19 +02:00
Giuseppe D'Angelo
7efacc7cbe Enable QT_TYPESAFE_FLAGS for bootstrap and QtCore
Change-Id: I5c64a29ffecece9e527f5db78cceb912836153d3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 12:49:19 +02:00
Giuseppe D'Angelo
4cc2f48628 QF*Engine: port a couple of QFlags->int implicit conversions to toInt()
Change-Id: Iafc3527941a0b56a680322e3bc05b4046e560e89
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 12:49:19 +02:00
Giuseppe D'Angelo
549394ebb9 QRegularExpression: port away from QFlags<->int conversions
Use fromInt/toInt.

Change-Id: I4af833e432fec2156c4ab96211b2bbc48aedd7cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 12:49:19 +02:00
Tasuku Suzuki
418850d559 Doc: bump the OpenSSL minimum supported version to 1.1.1
Pick-to: 5.15 6.1 6.2
Change-Id: Ibfc8b64be23eb023dafb875f367da98b7c7bb5f6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-23 10:49:19 +00:00
Morten Sørvig
713c2a7af6 wasm: remove QEventLoop workarounds
In general, QEventLoop::exec() _can_ be used as-is on
WebAssembly, provided that the event dispatcher supports
the use case.

Use cases that can work include calling exec() on a
secondary thread, or calling exec() on the main thread
if asyncify is used.

Some use cases will still require special casing for
Wasm, such as the non-asyncified QApplication::exec(),
but that can be handles closer to where the workarounds
needed, for example in QApplication.

This removes the partial support for nested event loops
on the main thread, which did not really work. Also,
we no longer call emscripten_force_exit() on QEvetLoop::exit(),
which makes it possible to exit a top-level event loop
without exiting the process.

Task-number: QTBUG-70185
Change-Id: I3a28f41b8547ed3ba1bdf6a835e6662483e34449
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-06-23 06:57:32 +00:00
Morten Sørvig
2e12c2caf5 wasm: do not quit() on beforeunload()
This is the wrong event: exiting the app here it is not
compatible with the back/forward cache for instance. See the
the MDN docs for the “Window: unload” event.

Instead, make the Qt default be that we assume the
app process will live “forever” until the browser
terminates it, much like modern process handling on
e.g. iOS.

We may want to come back to app lifecycle handling
at a later point. This might require changes to application
code: implementing main() in such that it supports
clean shutdowns and auditing showdown code to make
sure it is web-compatible.

Change-Id: I0f32026a3af76c9cc79e3aab31e8aaed7b8f8023
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-06-23 08:57:27 +02:00
Morten Sørvig
53eb44906c wasm: don’t set exit_runtime
Go with Emscripten’s default of not shutting down on
main() exit; this allows for writing main() in such
a way that avoids the exec() workaround.

Existing main() implementations (which do use the exec()
workaround) do not shut down Qt cleanly anyway, so we
gain little by shutting down the Emscripten runtime.

Applications can set this flag if they do want to shut
down on main() exit:
    LFAGS += -s EXIT_RUNTIME=1

Change-Id: I52e1cc2bc907d1d2146822713e39b7610db3f95b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-06-23 06:57:21 +00:00
Giuseppe D'Angelo
631a0cc45c Long live QT_TYPESAFE_FLAGS!
This commit adds an opt-in mechanism to kill type-unsafe functions
and implicit conversions of QFlags, therefore removing an entire
category of bugs that QFlags itself is supposed to protect against:

  QFlags<E> f;
  f == 3.14; // OK; f->int, int->double, then operator==(double,double)
  f & UnrelatedEnum;  // OK if of unscoped enum, calls operator&(int)
  f &= 123;   // calls QFlags::operator&=(int)
  int i = f * 42; // f->int, then operator*(int, int)

Thankfully, operator+ and operator- had already been deleted.

By defining QT_TYPESAFE_FLAGS one:

* disables operators taking (u)int, forcing the usage of an enumeration
or another QFlags object;

* turns the implicit conversions towards integers/bool in explicit
(one can always use fromInt/toInt instead);

* adds a convenience set of (in)equality operators against literal 0,
in order to keep code like `(flag & bit) == 0` compile. This set can't
be added normally otherwise it would add ambiguity;

* adds the unary operator~(Enum), turning it into a flag. This is
a source incompatible change, in general, so it's opt-in.

This is a Qt-internal macro at this point. It can't be offered to users
yet because we need to fix some public API flaws first: in some places
(e.g. QPainter::drawText)  we ask users to do type-unsafe manipulation
of flags. A user enabling the macro wouldn't be able to properly use the
functions in question.

This macro will be enabled in a follow-up commit.

Change-Id: I796f2256b446bafc12cdcbaf7de417d12bd3619e
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 03:14:09 +02:00
Thiago Macieira
a20a424066 QStringBuilder: fix warning about memcpying onto QChar
Which is not a trivial class.

qstringbuilder.h: In instantiation of 'static void QConcatenable<const char16_t [N]>::appendTo(const char16_t*, QChar*&) [with long long int N = 6]':
qstringbuilder.h:402:35:   required from 'static void QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::appendTo(const type&, T*&) [with T = QChar; A = char16_t [6]; B = QString; QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::type = QStringBuilder<char16_t [6], QString>]'
qstringbuilder.h:460:52:   required from 'QString& operator+=(QString&, const QStringBuilder<A, B>&) [with A = char16_t [6]; B = QString]'
/home/tjmaciei/src/qt/qt6-release/qtdeclarative/src/qml/jsruntime/qv4qobjectwrapper.cpp:1762:75:   required from here
qstringbuilder.h:338:15: error: 'void* memcpy(void*, const void*, size_t)' copying an object of non-trivial type 'class QChar' from an array of 'const char16_t' [-Werror=class-memaccess]

Change-Id: Iddb933f281024939b6acfffd1689cf320c84873c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-06-22 16:27:13 -07:00
Giuseppe D'Angelo
100fb6c3a0 QPodArrayOps: re-enable -Wstringop-overflow
The spurious warning is not emitted any more by GCC 10 / 11.
Even if it's still emitted by earlier GCC versions, now it's no longer
an error.

Change-Id: Ia8bf3e10905909c097ecc025bf89f818410a8dae
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 00:23:55 +02:00
Giuseppe D'Angelo
648e9696d3 Disable -Werror=stringop-overflow on GCC >= 10
There's a number of upstream bugs that cause false positives;
do not make them errors.

Change-Id: I4151794d8d37177a47a34aef8d83accf4377d44a
Pick-to: 6.1 6.2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-23 00:23:55 +02:00
Ulf Hermann
e99e07cb5c QString: Respect precision when reading data for %.*s format string
If we disregard the precision we may read a very large string that we
subsequently discard. Furthermore, people use this to read
non-null-terminated strings, which randomly crashes.

Pick-to: 5.15 6.1 6.2
Change-Id: Ifa255dbe71c82d3d4fb46adfef7a9dc74bd40cee
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-22 22:08:16 +02:00