summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 3rdparty: apply a fix to the last zlib fixv6.3.2Thiago Macieira2022-09-062-2/+35
| | | | | | | | Source: https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d Change-Id: Ic6547f8247454b47baa8fffd17111732eb074b0a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* 3rdparty/zlib: backport the fix to CVE-2022-37434Thiago Macieira2022-08-312-2/+38
| | | | | | | Qt isn't known to be affected by this. Change-Id: Ic6547f8247454b47baa8fffd171025f5a435a209 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QComboBox: Prevent recursion in hidePopupVolker Hilsheimer2022-08-262-1/+10
| | | | | | | | | | | | | | | | | | With styles that want the selected combobox item to flash, QComboBox runs a modal event loop in hidePopup. This might result in reentrancy if a mouseReleaseEvent is processed during the 60 ms of flashing. Since mouseReleaseEvent calls hidePopup again, we end up reentrancy and possibly undefined behavior which has caused crashes with Qt Creator on macOS. Prevent the reentrancy of hidePopup using a boolean flag. Since QBoolBlocker (or QScopedValueRollback) cannot be used with a bit flag, use a QScopeGuard to reset the flag reliably. Fixes: QTBUG-105951 Pick-to: dev 6.4 6.3 6.2 Change-Id: Iaa5df47b93217fc8dff621764ac4005bbc3459b7 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Don't access QObjectPrivate::declarativeData unguardedVolker Hilsheimer2022-08-223-3/+80
| | | | | | | | | | | | | | | | | | | | | | The QObjectPrivate::declarativeData member is stored in a union with currentChildBeingDeleted. The QObject destructor always sets the currentChildBeingDeleted member of the union. It also sets the isDeletingChildren bool, which is the only way to find out which union member we can safely access. While the QObject destructor is deleting children and isDeletingChildren is set, we must not access the declarativeData member of the union. Add a test case that initializes the function pointers for the declarative handlers and constructs a situation where an object emits a signal while it is destroying children. Fixes: QTBUG-105286 Change-Id: Iea5ba2f7843b6926a8d157be166e6044d98d6c02 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 3be99799a675a631c67e05897383af9abbc377b3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Repopulate theme fonts after invalidating CoreText font databaseTor Arne Vestbø2022-08-171-0/+7
| | | | | | | | | | | | | | | | The cross platform font database maintains the font descriptors for the system (theme) fonts, so when the font database is invalidated we need to clear our list of theme fonts so that the next call to QCoreTextFontDatabase::populateThemeFonts() will re-populate the system font descriptors. This issue was fixed in dev as a side effect of the change in d84018616a24fa66502cf62f5ebbcf5ed4ca0742. Change-Id: I2b2640d315c130c81ead50cf9a357831c2e07bf8 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 1ef1dca5458bed65a19e94ab62b50917ed46645d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QUnicodeTools: fix types used around th_brk()Marc Mutz2022-08-111-2/+2
| | | | | | | | | | | | | | | | | Libthai's th_brk() takes the breakpoints array lengths as size_t, so use that. This still doesn't fix thaiAssignAttributes() for ≥ 2 Gi characters, because th_brk returns break positions in an array of int, thus limiting any results to the first INT_MAX characters. Created QTBUG-105541 to track this. Task-number: QTBUG-103531 Change-Id: Iba468cc9389f4533401bc18dd326c4ca7e85a5da Reviewed-by: Lars Knoll <lars.knoll@gmail.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 50d1a8a3770df7ada3ef558db449c758444234bf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QUnicodeTools: fix truncation in debug statementsMarc Mutz2022-08-111-5/+5
| | | | | | | | | | | | Instead of casting to int, cast to qlonglong, which is guaranteed to be able to hold all qsizetype values. Task-number: QTBUG-103531 Change-Id: I3e89892defd091fa6ef305b8ed5c3819a2cc13da Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 8dbc569538da7011d3c2c7099abe8069ed3db68f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* [docs] Fix return value of QStringIterator::next()Marc Mutz2022-08-111-1/+1
| | | | | | | | | | | It's char32_t these days, not uint. Task-number: QTBUG-103531 Change-Id: Iaa03f97d0d1266a6763eb858edb45ae0f2a4729d Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit a8e6a0e546a6a90ff2daee79c3cf504b7160cb86) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QUnicodeTools: fix types used around th_next_cellMarc Mutz2022-08-111-3/+4
| | | | | | | | | | | | | | | | | Libthai's th_next_cell takes and returns lengths as size_t. - pass size_t, not qsizetype (the value can never be negative) - receive size_t, don't cast to uint As a drive-by, scope variables tighter. Task-number: QTBUG-103531 Change-Id: Ib1eeb1f0e8974ee8b0f88d080d06136b307c324f Reviewed-by: Lars Knoll <lars.knoll@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit ea1e005cb18cbd4fe9ceda725aac47bbfb068389) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: handle quoted args passed to an appAssam Boudjelthia2022-08-113-10/+14
| | | | | | | | | | | | | | | | | | | | | | | Currently, arguments passed to the app through applicationArguments extra bundle treat every space as an argument separator. This then doesn't handle the case where an argument is a space separated quoted multi-word. This is more apparent when androidtestrunner is passing test arguments to the app where an argument can be a test case with a data tag that contains a space, which then is treated as two separate tag names. This change makes sure that androidtestrunner quotes each argument, and the app doesn't split the arguments list by spaces, but rather passed the argument string directly to c++ where QProcess::splitCommand() is used to get the correct set of arguments that will be passed to main(). Task-number: QTBUG-104730 Change-Id: I45d8ca979d90f2a383c84623f0eb2eec29bba727 Reviewed-by: Dimitrios Apostolou <jimis@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit edc024e826d41a98cb7779e9834e83d7ea5da171) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QTranslator: generalize a UNIX-only pathGiuseppe D'Angelo2022-08-101-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QTranslator builds a list of "candidate" names in order to find out the translation file to load. Part of the name comes from the UI languages, as determined by the QLocale object passed to load() (via QLocale::uiLanguages()). On UNIX this list of languages is processed by adding a lowercase version of each language. In other words, if the list is something like: {"en-Latn-US", "en-US", "en"} then it is changed to contain: {"en-Latn-US", "en-latn-us", "en-US", "en-us", "en"} (The last element is not needlessly duplicated, since it's already fully lowercase.) I am not sure why this is done only on UNIX: the commit introducing this behavior predates public history. If I have to take a guess, it's done because the language is then used to assemble a file name that QTranslator tries to open. On UNIX file names are case sensitive, so if the translation file is called "translations_en_us.qm" it would fail to load under a "en-US" locale (the "-" -> "_" processing is done later). But what about Windows? In principle, turning the names in lowercase is not necessary as Windows' filesystem is case insensitive; a translation file called "translations_en_us.qm" will still be loaded if opened as "translations_en_US.qm"... ... *except* if the file is in the resource system! In that case, filesystem access is still case sensitive, and will fail to load the translation file (which instead would load just fine on UNIX). Plug this silly cross-platform difference by also lowercasing on Windows. Change-Id: I2573721e33d9da08f60a5bb56e35e4553cbe4efe Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit b779b8062cdeef5f2ac33c9164b5846780cfd495) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSqlQueryModel: guard the definition of deprecated methodIvan Solovev2022-08-101-1/+2
| | | | | | | | | | | | | | ... to prevent compilation errors when built with QT_DISABLE_DEPRECATED_BEFORE >= 0x060200 This commit amends 14f9f00fdb2dc428610c08e3d9d03e38e9602166 Task-number: QTBUG-105048 Change-Id: I33c586508353ccb4c0af3f5da0cdaf9abe9f590e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit 7ba39fff8d9d6c8b6d7629c599dd57d14a379cec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Remove repetition of word in textPaul Wicking2022-08-101-3/+3
| | | | | | | | | | | | While dropping the extra "does", rewrite as "doesn't" as common contractions are preferable in particular in negations. Reflow the remainder of the paragraph. Fixes: QTBUG-105517 Change-Id: I1ad2d5ca753cb1d3a38cf96bdd6e52d2af80151b Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> (cherry picked from commit 998bd0b528760d320c56026c2dd96204ecfb3b5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix detection of system double-conversionJoerg Bornemann2022-08-101-4/+9
| | | | | | | | | | | | | | | | | | | | | | | ...if the double-conversion CMake package cannot be loaded. The find_path call must specify the header exactly as it is included. The select_library_configurations call always failed, because the command expects the presence of DOUBLE_CONVERSIONS_LIBRARY_DEBUG, DOUBLE_CONVERSIONS_LIBRARY_RELEASE, or both. Upstream double-conversion's MSVC build system does not specify a naming scheme for the debug build, and there are no debug/release binaries to download that suggest a naming scheme. Therefore we assume the usual 'd' suffix for the debug library like we do everywhere else. Lastly, we need to set DOUBLE_CONVERSION_INCLUDE_DIRS. Fixes: QTBUG-105501 Change-Id: I71ff5238f353541b8bf5ac6792b86134deba20d1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit a29af6656f1c33355c4cbfe8587b8f6eae691a21) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add some testing of QTestEventLoopEdward Welbourne2022-08-1010-2/+333
| | | | | | | | | | | | | | | | | Fairly minimal for now, just enough to verify a bug and serve as the sign of success when it's fixed. Tests fail in ways they shouldn't, for now; see expected_eventloop.* for details, notably "Earlier test failed to clean up" messages. On pick: regenerated expected_eventloop.* (there are testlib changes in 6.4 that affect the output; mostly formatting - so diff -w gives a much smaller difference to 6.4 - but also some details of test-case counting that affect tap and txt). Task-number: QTBUG-104441 Change-Id: I59be4aa5f21fed23b19a0593a8c2f6c9956507df Reviewed-by: Jason McDonald <macadder1@gmail.com> (cherry picked from commit 35ad157d88c7bfcb9b90b01111b0f43dd2e012d9)
* Remove redundant define for QT_LARGEFILE_SUPPORTSona Kurazyan2022-08-101-4/+0
| | | | | | | | | It's unconditionally set in qconfig.h by configure.cmake. Change-Id: If10b5a34111856f4c279a1cf7bfc4ea3a995ef2b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 64ac64ba6bb2f70ab6aafb9af91b142a765956c7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSqlQuery: Do not use deleted constructor in docsFabian Kosmale2022-08-101-2/+2
| | | | | | | | | | | QVariant(QMetaType::Type) is deleted since Qt 5 (sic!). Suggest usage of the constructor taking a meta-type instead. Change-Id: I50949dac9dfc35c80108debdeabc791afe0998b6 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 879d30394a41b7b7124fc8139e787a9bdbe0dfee) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Ensure consistent cursor width under fractional scalingEirik Aavitsland2022-08-101-1/+14
| | | | | | | | | | | | | | | Under fractional scaling, an N units wide rectangle can in general cover either M or M+1 pixels, depending on placement. For a tall thin recangle like the cursor, this difference becomes very visible as the cursor moves from position to position. Avoid by instead painting the cursor as a cosmetic line in such cases, since that keeps its width independently of the current transformation. Fixes: QTBUG-95319 Change-Id: I31a31f89fe7eac3037694946aa452a9f2bd6e5be Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 3709bc3699ef0632bd2af53b02d44d130b8c0e13) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Documentation: Fix "Using Model Indexes" in Model View Programming guide to workFriedemann Kleint2022-08-092-29/+40
| | | | | | | | | | | | | | The code introduced by 54d5ca0c2766e915c960fa437cee6c20a324c1a7 did not work since the variables parentIndex/numRows were local to the lambda and the outer code would not wait. Move the widgets population into the lambda to fix this. Modernize the remaining code a bit. Change-Id: I2a09878987df9edb9ff04f0ac4ad82af1a8b52c8 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit c49bf9fe27e0632aa8da393ff007cf4577a1c9cd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't skip QDoubleConverter's digit-count check for non-whole boundEdward Welbourne2022-08-092-1/+6
| | | | | | | | | | | | | | | | | Using convertDoubleTo() to get a whole number, from which to determine the number of digits we're allowed before the fractional part, fails if the double isn't a whole number, which lead to the skip being checked. Use qFloor() of the double (as this should have as many digits as the double had before its decimal point, which is what we care about; qCeil() might round up to a power of ten). This amends commit ff6d2cb0d5779d81e89d94d65c8d164602fa2567 Fixes: QTBUG-105341 Change-Id: I4e0105d4602682c59e9830ec9a37556c96db884e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit a79de46ac59e045fbbbb8e0490ea6981b041be73) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmake: Fix installation of separate debug info for pluginsJoerg Bornemann2022-08-091-1/+1
| | | | | | | | | | | | | | | This amends commit fc2e40e88d44d457ec5ebd1cc235696f3f478be9. For Qt plugins, we do not add 'dlltarget' to INSTALLS but only 'target'. In this case we must add the .dll.debug file to 'target' like we did before fc2e40e88d4. Fixes: QTBUG-105374 Change-Id: If495548dfca55d02e1c5884e03e281e27ee07ccd Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> (cherry picked from commit 38ca34ac935e222d532fc5f6939efaa15c633b39) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Drop parentheses around \since commandPaul Wicking2022-08-091-2/+2
| | | | | | | | | | | | The closing parenthesis ends up in the output. As the fix to QDoc is rather involved, clean up the docs to fix the symptom. Fixes: QTBUG-105339 Change-Id: I35a1e7615125781d950649213c08e5760b0235e7 Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> (cherry picked from commit 1a825d884907c7c30064b655bc1dda76d5009d87) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* iOS: ensure we close inputpanel after clearing focusobjectRichard Moe Gustavsen2022-08-091-0/+9
| | | | | | | | | | | | | | | | | Change 7f72622c0f caused a regression where the input panel would not close automatically when the focus object was cleared. The reason is that it's apparently not enough to just release the first responder, we also need to explicitly tell it to release it's first responder status. Before the failing patch, we did this from within update(). This patch will instead/in addition do an extra check from inside reset(). Fixes: QTBUG-105323 Change-Id: I00bdd44fe54db69f44232226291e3c5715935749 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit e2e4428f0ffa79a032f56812dd89f0b8b8af63f9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Polish the model/view tutorial examplesFriedemann Kleint2022-08-0911-51/+55
| | | | | | | | | | | | | | - Reorder the class declarations, moving private sections last - Make constructors explicit - Add space to the comments - Introduce auto - Replace slot MainWindow::showWindowTitle() by a direct connection to slot QWidget::setWindowTitle(). Change-Id: Ic229162434dfef5f2767d0b4e186759ca0f821f3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 8751ca3daeaa2a500a37b070cdcce5a5bb7a165f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QDBusMetaObjectGenerator: use qsizetype for counting thingsThiago Macieira2022-08-091-26/+28
| | | | | | | | | | | | | | | | Even though the meta object format stores 32-bit integers, which means we can't have anywhere near 2 billion properties, methods, method parameters, etc. This suppresses the warning that we may be trying to allocate a negative amount of data in qdbusmetaobject.cpp:438:60: warning: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=] Task-number: QTBUG-105388 Task-number: QTBUG-103548 Change-Id: Ie4bb662dcb274440ab8bfffd17096df93614be8e Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 68eb0e673ce43dc25b479932aedc98aff1b727e3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QGraphicsScene::render: fix int/qsizetype mismatchThiago Macieira2022-08-091-3/+3
| | | | | | | | | | | | Also suppresses the warning that we may be trying to allocate -1 items in call to new[]. Task-number: QTBUG-105388 Task-number: QTBUG-105471 Change-Id: Ie4bb662dcb274440ab8bfffd17096d3606354647 Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 70d040fa1abb5c195643a9e2c5d8681ba1ea54c9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Basiclayouts: Add scrolling to exampleElias Hautala2022-08-081-2/+17
| | | | | | | | | | | | Adds scrolling to basic layouts example because the user interface in the example doesn't fit properly on smaller screen sizes. Fixes: QTCREATORBUG-27634 Change-Id: I61e6eac2b28e5b3ff0f984894fe38167b3f46a9c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Markku Nokkala <markku.nokkala@qt.io> (cherry picked from commit 89ce9a1c5a29e3f420931baa88c705856b99ac25) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Freetype: Fix underline thickness for bitmap fontsEskil Abrahamsen Blomfeldt2022-08-081-1/+1
| | | | | | | | | | | | | | | For non-scalable fonts, we calculate the underline thickness based on the font size. To make the lines slightly thicker for bold fonts, we also multiply a fraction of the weight of the font into it. In Qt 6, however, the weight scale was multiplied by 10, but the formula was not updated, hence all underlines for bitmap fonts would be 10x too thick. Fixes: QTBUG-105010 Change-Id: I108baed495048783b14afca6bd4c67dc83816c17 Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io> (cherry picked from commit 6fa2ce92af914d8fd6ab1fc32316b14bbae0bed0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProperty: Notify observers even when dependency is goneFabian Kosmale2022-08-084-30/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem description: -------------------- Assume we have two properties, P1 and P2. Assume further that we assign a binding to P2, so that it depends on P1. Let the binding additionally capture some (non-QProperty) boolean, and only create the dependency to P1 if the boolean is true. The state afterwards is P1:[p1vaue|firstObserver] | | v ---[p2binding] / P2:[p2value|binding] If the boolean is set to false, and P1 changes its value, we still correctly re-evaluate the binding and update P2's value. However, during binding evaluation we will notice that there is no further dependency from P2 on P1, and remove its observer. The state afterwards is P1:[p1vaue|firstObserver=nullptr] ---[p2binding] / P2:[p2value|binding] Then, during the notify phase, we traverse the observer's again, starting from P1's firstObserver. Given that it is nullptr now, we never reach P2's binding, and thus won't send a notification from it. Fix: ---- We store a list of all visited binding-observers (in a QVarLengthArray, to avoid allocations as long as possible). After the binding evaluation phase, we then use that list to send notifications from every binding that we visited. As we already have a list of all bindings, we no longer need to recurse on binding-observes during the notification process; instead, we only need to deal with static callbacks and ChangeHandlers. The pre-existing notification logic is still kept for the grouped update case, where we already have a list of all delayed properties, and should therefore not encounter the same issue. Unifying its codepath with the existing logic is left as an exercise for a later patch. Fixes: QTBUG-105204 Task-number: QTBUG-104982 Change-Id: I2951f7d9597f4da0b8560a64dfb834f7ad86e757 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit f1b1773d0ae636fa9afa36224ba17566484af3cc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QtBase: eradicate QT_STRINGVIEW_LEVEL usesMarc Mutz2022-08-0821-130/+2
| | | | | | | | | | | | | | | | | | It's not used and not useful. The macro itself has to stay, for now, because Qt5Compat uses it, too. Conflicts: - qlocale.h - qlocale.cpp - qstring.h Task-number: QTBUG-100861 Change-Id: I5d0557a6c959d6facf6e47f26786a9d365339e95 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 16c453069f7b44ba7328a178b4b9ce99a150813e) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qputenv: defend against non-NUL-terminated QByteArray valuesMarc Mutz2022-08-082-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code assumed that a QByteArray's data() is always NUL-terminated. Due to the conflation of owners and non-owners in QByteArray (but also in case we ever get efficient substringing), this is not always the case, e.g. QByteArray::fromRawData() does not ensure NUL-termination. From QString::utf16(), we learn that the condition to check for is QArrayData::isMutable(). After working around the fact that QByteArray::data_ptr() doesn't exist for const QBAs and that empty QBAs always refer to QByteArray::empty_, which is !isMutable(), we can detect this situation and re-allocate without introducing new API. This is the fix for Qt ≤ 6.4. For Qt 6.5, we'll port the function to QByteArrayView. Manual conflict resolutions: - tracked changes into qglobal.cpp (was: qenvionmentvariables.cpp) - QCOMPARE_EQ → QCOMPARE Fixes: QTBUG-105302 Change-Id: I3416535ab09d601e0e87b2767f2c024ba1217e64 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 15422d191fb03eb9cafe68b24484d59c1270244c) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QByteArray: fix base64 round-trip w/more than 2GiB dataMarc Mutz2022-08-062-2/+42
| | | | | | | | | | | | | | | | | | | | There was an explicit int cast in fromBase64Encoding() which was never ported to qsizetype and therefore truncated the result. Fix by removing the int cast. Add a test, optimize it for as low memory usage as possible, given we need to work in input and output data each in excess of 2GiB. Manual conflict resolutions: - QCOMPARE_EQ → QCOMPARE Fixes: QTBUG-104985 Change-Id: I9c0924957e62e5cb3003132cd811b8b0315d8ac1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit d76bf645316a13495672741e54d270bada03752c)
* QMetaType: don't create a registry just to query its emptiness [2/2]Marc Mutz2022-08-051-2/+2
| | | | | | | | | | | The previous commit, b0e4d53b637e6c34457d14ed3f0be705098bf2f5, missed this one. Same rationale as back then. Change-Id: Ibad4c130e0d61c64808275fa7b97b58ebd479acc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 5f5c4598fed4b4bdd95271d1fee8a57fbd21d033) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QLocale: port to qsizetype [1/N]: indexed to ranged loopsMarc Mutz2022-08-053-10/+8
| | | | | | | | | | | | | | | Ranged for loops are independent of the container's size_type, so port what we can to them. Conflicts: - qlocale_unix.cpp Task-number: QTBUG-103531 Change-Id: I0fd5c9c721e892ea617f0b56b8ea423e7a9f0d04 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 88f2a78594e0272d7916e13aca39611a85571937)
* Fix QString::toHtmlEscaped() for >2Gi character stringsMarc Mutz2022-08-061-7/+7
| | | | | | | | | | | | | | More unfinished int → qsizetype porting. Manual conflict resolutions: - _L1 → QLatin1String - but keep the QLatin1Char → u'' changes as a drive-by Fixes: QTBUG-105104 Change-Id: I3470de31c476b3d7736661550916828e43546573 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit c1991c63fc081a42ed3e6a28f82f395c54ef42a1)
* macOS: Check m_platformWindow before processing key event after shortcutTimur Pocheptsov2022-08-051-1/+1
| | | | | | | | | | | | Processing shortcut events may result in the window being deleted, so we need to check if m_platformWindow is still valid before continuing with the key press event. Fixes: QTBUG-105160 Change-Id: I9cd362873b19c078a4fced3ac3c815d70bfc7fbe Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 6a5cadb9557ebac00b8ddacf623dc38baa716680) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Fix return type of QLEInteger/QBEInteger post-in/decrement opsJoerg Bornemann2022-08-051-4/+4
| | | | | | | | | | Those operators return a value, not a reference. Fixes: QTBUG-104940 Change-Id: I117892f12d20c6bf32a12f37c1bdfec1817614c6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit d336cfba8ad740dc812b8987bc04fb9f6da80666) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QStringIterator: fix UB [1/2]: use has{Next,Previous}() moreMarc Mutz2022-08-051-6/+6
| | | | | | | | | | | | | | | | | Replace - pos > i with hasPrevious() - pos < e with hasNext() Everything is inline, so there's no difference in assembly, but less source code lines to fix later. Change-Id: I3f9cf2716c96b811b29b75fa20f88cc3b461771a Reviewed-by: Mate Barany <mate.barany@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 34800d1f09447e921203561c0e4804c4f095136f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QByteDataBuffer: assert an undocumented preconditionMarc Mutz2022-08-051-0/+1
| | | | | | | | | | | | The alternative would be to return a null QByteArray, but the current implementation makes calling read() on an empty QByteDataBuffer UB, so this is behavior-preserving, just with a bit nicer error message. Change-Id: Ia9db7acbfa47e601b466d6cc6a728859065c27b5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit 011b68d3cd95295890b1ed724aa4331ff5680eed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Statically assert that the __mips_dsp code is only active on 32-bitMarc Mutz2022-08-051-0/+4
| | | | | | | | | | | | | | | | | I was told this is 32-bit-only code in Qt 5, where it didn't really matter, because only QStringView could handle > INT_MAX character strings. Put up a big stop sign now in Qt 6 to enforce that this information is correct, incl. notes for when it turns out it isn't. Task-number: QTBUG-59150 Task-number: QTBUG-103531 Change-Id: I4620a43e2e67776cc67531fa993a7bb8e01cffed Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 753079b7074b06d237a0ae7a58281c28df134fc0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QString::arg() for format strings with a huge amount of placeholdersMarc Mutz2022-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | QString::arg()s placeholders are limited to triple-digits, so 1000 different ones. By the same token, the length of any one of them is bounded to five (%L?\d{,3}). But the total possible length of escape sequences is _not_ 5000B, because there's no limit on the number of _equal_ placeholders, so a format string where the total escape sequence length exceeded 2Gi characters, e.g. QString("%L100").repeated(INT_MAX/5 + 1).arg(42); would produce corrupt data. Task-number: QTBUG-103531 Change-Id: Id27ee02579387efcbb5928de1eb9acbeb9f954c9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 15a80cf8a9d59203f8e2b436a5c804197c044807) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Port qt_doubleToAscii to qsizetypeMarc Mutz2022-08-053-5/+12
| | | | | | | | | | | | Allows central handling of large buffers. Adjust some callers. Task-number: QTBUG-103531 Change-Id: Ib55974c3de250883cd0f6d11a7eee051c7fd11bc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit bd43c245e8c641c3a5c86762647f99658167b4db) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Port QUtf8BaseTraits to qsizetypeMarc Mutz2022-08-051-2/+2
| | | | | | | | | | | | | It's unclear why the the char8_t overloads have int sizes. At the time 60aa0d086886aea58d6b7a09484645ad1d92a220 added these, the uchar overloads were already using qsizetype. Task-number: QTBUG-103531 Change-Id: I8ed4c5462de29a7d48255e440e34bcd5114755fe Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit ab512adf12a2ba36b51f36d7c998d1cbdcf6505a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix stringish::simplified() for strings > 2Gi charactersMarc Mutz2022-08-051-1/+1
| | | | | | | | | | | | | | If, after simplification, the result string would have been >2Gi characters in length, the code returned a shorter string, truncated mod INT_MAX, because the algorithm had not been ported to qsizetype. Task-number: QTBUG-103531 Change-Id: I57cfed34e5c69406f8d3f2913962d006b4bc6bd0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit ec35efd7f2cea4dcbe0188f0d44cde541803f53e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QString::arg() for format strings > 2Gi charactersMarc Mutz2022-08-051-1/+1
| | | | | | | | | | | | | | The getEscape function truncated the qsizetype position it got from the caller to an int, potentially parsing a previous escape sequence (or, more likely, garbage), by getting the position in the string wrong. Task-number: QTBUG-103531 Change-Id: I3b921c0991d238bbacfe6699c56146fe032134df Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 841ff3b73f9951e49b6406007d76302b3f367f55) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Port QStringIterator to qsizetypeMarc Mutz2022-08-052-8/+8
| | | | | | | | | | | | | | | Most of the API is formulated using iterators, but index() and one of the ctors still used int. Patch users. There appear to be no users of this class outside of QtBase. Task-number: QTBUG-103531 Change-Id: I097ce839d74ff76bd8c1925d09634ffeaaa2fc07 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 4ed2c92bf4d46e6d4c9d8c321a35aa0bfc368fbf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QString::toLatin1() for strings > 16Gi characters on ARM64Marc Mutz2022-08-051-2/+2
| | | | | | | | | | | | More qsizetype truncation to int, this time in the number of chunks in SIMD processing, so the limit isn't 2Gi, but 16Gi. Task-number: QTBUG-103531 Change-Id: Ib584c8dc7aa8dedc1cb8181e7d6f20b582c93f8c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 0b5d4c3eae8cd8024bc6e1df6321e2ad5deabb76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QString::vasprintf for strings > 2GiBMarc Mutz2022-08-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Both format strings > 2GiB, as well as result strings > 2Gi characters were affected by the append_utf8() helper function being left unported from int to qsizetype. There were actually two bugs in that 5LOC function: 1. The len argument was an int, but the caller feeds a difference of pointers (even explicitly cast to qsizetype) to the function, so any stretch of verbatim text > 2GiB in the format would cause the output string to be corrupted. 2. If the result string was already > 2Gi characters in size, a call to append_utf8() would truncate it mod INT_MAX, because the string's size() was stored in an int variable and the used in a resize() call. Task-number: QTBUG-103531 Change-Id: I0a09d27b7782093d3f8ea17bb621ff8dad375072 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit f73833809b87feb4046c7bdc1fedb3b3a14e80ec) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Port qenvironmentvariables.cpp to qsizetypeMarc Mutz2022-08-051-5/+4
| | | | | | | | | | | | | | | | | | | | | | | I don't expect environments to allow values or names > 2 Gi characters, so this is just for consistency (int is a code smell these days). As a drive-by, replace QString buffer; buffer.resize(n); with QString buffer(n, Qt::Uninitialized); Task-number: QTBUG-103527 Change-Id: I0e41a6e7e9c44ff1ec22377329735538d5f95181 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit c25cc34a05c0838052b9a5d6624336ef2a2ae8ea) Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* macOS: Don't ifdef out code to resolve display name that might be usedTor Arne Vestbø2022-08-051-2/+0
| | | | | | | | | The call to displayName is not guarded by the same ifdef. Change-Id: I169777130ec316a2d2f837621280acb061072501 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit b9a9edc52fd88745f6f45c76e48f1c2e32677e5c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>