summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
Commit message (Collapse)AuthorAgeFilesLines
...
* QJniArray: fix prototype of member functionsVolker Hilsheimer2024-01-231-5/+5
| | | | | | | | | | | | Remove the redundant template parameter. As a drive-by, swap pointer members using qt_ptr_swap instead of std::swap. Found during header review. Pick-to: 6.7 Task-number: QTBUG-119952 Change-Id: Ibed9c7e7866672401b9dd87ff6e33db8f61e7282 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QJniArray: add test case for QJniArray::sizeVolker Hilsheimer2024-01-231-1/+2
| | | | | | | | | Fix build of the test by removing the reference from the container type before accessing the nested typedef. Pick-to: 6.7 Change-Id: Ic35f312bac70b8f8f80149a3432329070c8c8c7d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* invokeMethod: std::forward universal-ref argumentMårten Nordheim2024-01-201-1/+1
| | | | | | | | | Spotted in API review Pick-to: 6.7 Change-Id: I4ab660bb9955176f40b4123e775d65c17edbeeb8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaObjectBuilder: Avoid arithmetic on null pointerFabian Kosmale2024-01-191-2/+2
| | | | | | | | | | | | In Prepare mode, "buf" is a null pointer. We never dereference it, but we still compute an offset from it to obtain a pointer to a (then unused) QMetaObjectPrivater. clang's UBSan complains about this, so initialize the pointer to nullptr instead when in Prepare mode. Pick-to: 6.7 6.6 6.5 Change-Id: Id9d78058f72bb1b44440d07f565374f3eb3c20fd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaTypeModuleHelper: mark instances constexprMarc Mutz2024-01-191-1/+1
| | | | | | | | | | Static and thread-local objects should be constexpr or constinit if possible. Task-number: QTBUG-100485 Pick-to: 6.7 6.6 6.5 Change-Id: I29088798a50d6278252c9088e7c191c4214b2e5b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix export of QDeferredDeleteEvent, should be Q_CORE_EXPORTMatt Aber2024-01-191-1/+2
| | | | | | | | | | | | When QDeferredDeleteEvent was declared in qcoreevent.h, it had Q_CORE_EXPORT. After moving to qcoreevent_p.h, it changed to Q_AUTOTEST_EXPORT. The correct macro should be preserved. Noticed that this change was needed to make GammaRay work with Qt 6.7 Pick-to: 6.7 Change-Id: I6fab494d9f60b1261edce6f326a3b96467ff7da1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTest: remove static keyword from the new qWaitFor() chrono overloadAhmad Samir2024-01-191-1/+1
| | | | | | | | | This is a function template defined inside a namespace, `static` makes no difference here. Change-Id: I2eb52b4fb4432c269b2449ae37550bd0be0dbbce Pick-to: 6.7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QEventLoopLocker: use macro to implement move-ctorIvan Solovev2024-01-181-2/+1
| | | | | | | | | | | | We do have special macros for this case, so use one of them! Amends c2956f8f7685b624d7693ff644125d0f594c585d Found in 6.7 API review. Pick-to: 6.7 Change-Id: I205966d6f7363abf1a26f59b04555b1a48a4e696 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QMetaTypeModuleHelper: suppress cppcoreguidelines-virtual-class-destructorMarc Mutz2024-01-181-0/+1
| | | | | | | | | | | | | | | | | | | | Says clang-tidy: destructor of '(unnamed struct at qmetatype.cpp:966:14)' is public and non-virtual in file:src/corelib/kernel/qmetatype.cpp line:966 col:14 static const struct : QMetaTypeModuleHelper Yes, these classes are polymorphic (because the base class is). Yes, the destructor is non-virtual (because the base class' one isn't, but it's also protected, so fine). But these classes are not used as base classes, so suppress the warning. Pick-to: 6.7 6.6 6.5 6.2 Change-Id: I75be86bca36a4a0e93d72acb1a0d2fe0dca1c505 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaType: Assert on consistency when unregisteringUlf Hermann2024-01-171-6/+15
| | | | | | | | | If we are trying to unregister a metatype with an ID that belongs to a different metatype, then something is very wrong. Change-Id: I3191557883b69030f91c3aca7f359acf2dde66e7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove foreach snippets from the documentationKai Köhne2024-01-161-5/+0
| | | | | | | | | | | | | | | We don't recommend foreach anymore, and have in fact adapted two snippets already to use for(), but missed the documentation text. In any case, it feels a bit weird to give an example how to iterate over QStringList in each of these methods, so we might as well just remove this part. Pick-to: 6.6 6.7 Change-Id: If8744e48961661ad518f5f24781c38f371d981bc Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix stub qt_jspi_resume_js() return valueMorten Sørvig2024-01-151-1/+2
| | | | | | | | Return bool for the dynamic linking stub, like the actual function. Change-Id: I0e0daeac3d647055fecb7930f9ed8e6f9f574bb5 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QObject: de-pessimize installEventFilter()Marc Mutz2024-01-151-3/+3
| | | | | | | | | | | | | | | | | Don't loop over the list of event filters twice, do it once with a combined predicate. This code is still has a big impedance mismatch: the removeIf() will always leave empty space at the back while prepend() needs it at the front. We should fix this by reversing the meaning of the order of event filters to mean back()-is-applied-first, so new filters can be append()ed, but that is for another patch. Done-with: Jarek Kobus <jaroslaw.kobus@qt.io> Pick-to: 6.7 Change-Id: I08324697229a54c8f66c6c320cf7232d707a08f1 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* QObject: Optimize removeEventFilterJarek Kobus2024-01-151-3/+5
| | | | | | | | | | We can't have duplicated filters installed, so break the loop when removing event filter after we have found the matching one. Pick-to: 6.7 Change-Id: Idda87f3090954e020b27bf3fab62677128607f03 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QObject: clarify docs wrt. member access following Q_OBJECT and coAhmad Samir2024-01-141-0/+11
| | | | | | | | | | | | The macros expand to declarations that end in a private: section, which means everything following them is private. As Fabian said in the bug report, this is obvious when Q_OBJECT/GADGET ...etc are used in a class, but might be a bit surprising when used in a `struct`. Fixes: QTBUG-120297 Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: Iacdfc4eb3bab3554cc1142f682b11b32c3868b8f Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QObject: Make it clear we don't install duplicated event filtersJarek Kobus2024-01-111-0/+3
| | | | | | | Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I3048b50700880dd2445a5a65823fef02b196ce7d Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QObject: assert connection type isn't UniqueConnection for lambdasAhmad Samir2023-12-221-1/+6
| | | | | | | | | | | | | | | An assert is harder to miss than a warning, which makes it more likely to get fixed. Thanks to Mårten Nordheim for the idea. Add the assert in inline code so that users compiling their code in debug mode (or with -DQT_FORCE_ASSERTS) can hit the assert even when built agaist a release build of Qt (not everyone compile their code with a debug build of Qt). Thanks to Giuseppe D'Angelo for the idea. Pick-to: 6.7 6.6 6.5 Task-number: QTBUG-115125 Change-Id: I2935d32ea5a2c288d7a836abbae66ac53cb5ab2f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QObject: re-add the nameless qt_qFindChildren_helper to restore BCThiago Macieira2023-12-211-0/+2
| | | | | | | | | | | | | | | | | | Amends e608bc019232f6956c4520be1a6103a1845c6991 by adding the implementation of this method whose implementation got accidentally removed (because it became unused). It's added in removed_api.cpp because, as the commit said, the cost for creating an empty QAnyStringView is practically nil. It's not zero on Windows, because the replacement function has five parameters, so the last (the options) is passed on the stack. But that is not enough of a justification to keep separate functions. Pick-to: 6.7 Fixes: QTBUG-120309 Change-Id: I6e2677aad2ab45759db2fffd17a29b4ec7728426 Reviewed-by: Rym Bouabid <rym.bouabid@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add categorized logging of delete later machineryTor Arne Vestbø2023-12-214-10/+62
| | | | | | | | | A QT_MESSAGE_PATTERN including %{backtrace depth=4} should give the call site of the QScopedScopeLevelCounter. Task-number: QTBUG-120124 Change-Id: Ie477994882bde9168c931479102017ad5fde426a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add a comment to highlight QSpontaneKeyEvent usage in QtWebEngineAnu Aliyas2023-12-201-0/+2
| | | | | | | | | | | - QtWebEngine event handling requires forwarding events as spontaneous. - Impersonated QSpontaneKeyEvent in QtWebEngine to handle such cases. - Added comment to explain QSpontaneKeyEvent usage in QtWebEngine. Tasks: QTBUG-118398 Change-Id: I0ef951802727065bed660210e407a5a830956adf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Use Qml DefaultProperty as example for Q_CLASSINFOKai Köhne2023-12-201-6/+9
| | | | | | | | | | | Setting a DefaultProperty is arguably something more useful to people than the 'made up' version example. Also add more links to the relevant QML pages. Pick-to: 6.6 6.7 Change-Id: Id967df7ddf81511299f95b9fd24f56af671fb855 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Fix documentation issues for Qt CoreTopi Reinio2023-12-193-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix template arguments in \fn signatures for Qt::compareThreeWay() functions. * Fix template arguments in \fn signatures for QDebug::operator<<() functions. * Fix \sa links to specific overloads of QSpan functions. * Fix \sa links to specific overloads of QFileInfo::fileTime(). * Remove references to 'Custom Type Example' (example has been removed). * Fix linking to 'JSON Save Game' example. * Fix references to 'Queued Custom Type' example. * Fix linking to QCryptographicHash::Algorithm. * Fix linking to Qt Qml module. * Fix undocumented parameters in qHypot(). Pick-to: 6.7 Change-Id: If9eb9978a14e147f003672a682972b319454c311 Reviewed-by: Luca Di Sera <luca.disera@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Move QDeferredDeleteEvent loop level/scope handling into deleteLater()Tor Arne Vestbø2023-12-194-43/+46
| | | | | | | | | | | | | | | | | | | We have all the information we need when deleteLater() is called, so there's no point in deferring it until the event is posted, which requires friended access into the QDeferredDeleteEvent's members. Moving the code focuses QCoreApplication::postEvent() on its primary task, posting of the event (adding to the event list, waking up the event dispatcher). It's also easier to reason about how the action of deleteLater on an object relates to the event loop and scope level when the information is resolved up front. Task-number: QTBUG-120124 Change-Id: If38f601ff653111763004b98915b01ffe8ddc837 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Tweak QObject::deleteLater() documentation a bitTor Arne Vestbø2023-12-191-4/+0
| | | | | | | | | | The Qt 4.8 reference is not relevant. And mentioning that calling the function more than once is safe, or why that is, is strange, as users should still treat the object as something that will go away soon. Pick-to: 6.7 Change-Id: Icf24aa8ffe079e35351006dd77063df48a596fab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Document how to process deferred deletes in a plugin-scenarioTor Arne Vestbø2023-12-191-0/+15
| | | | | | | | | | | | | | | | | | | | | When Qt is not driving the event dispatching, the event loop level of the thread will stay 0. As a result, we will not automatically bump the deferred delete event's scope level to 1 when the deferred delete happens from a code path that doesn't raise the scope level via QScopedScopeLevelCounter, leaving the event with loop and scope level 0. As we only process these 0+0 deferred delete events automatically from QCoreApplicationPrivate::execCleanup(), which is not going to be called when the app doesn't call QCoreAppliction::exec(), we were failing to process the deferred deletes both during the application's runtime, as well as on shutdown. Task-number: QTBUG-120124 Fixes: QTBUG-117975 Pick-to: 6.7 6.6 6.5 Change-Id: I2b8accb432517a48370923ee2d760f8e2e4a8055 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* JNI API review: minor cleanups of QJniArrayVolker Hilsheimer2023-12-192-21/+33
| | | | | | | | | | | | | While the QJniArray type still is expected to be a QJniObject, we should still make the QJniArrayBase type non-constructible by making the constructors protected. Also make the destructor of that type protected and add explicit default implementations of the SMF. Name the SFINAE helper and predciate consistently as IfCanConvert. Pick-to: 6.7 Change-Id: I7a7c6a320fe9acb0758b53d94832d355c99cb6bb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* JNI API review: use has-a-QJniObject relationship for QtJniTypes typesVolker Hilsheimer2023-12-193-175/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't subclass QJniObject. It's not necessary, and gets us into UB territory due to QJniObject not having a virtual destructor. Also, rename the helper class to JObject, as Object is a valid Java class that one might want to be able to declare explicitly. Instead, give the declared QtJniTypes types a QJniObject member that they forward the calls to. That requires some duplication of APIs, but at the same time makes it unnecessary to explicitly remove the old QJniObject APIs that we want to ultimately deprecate. We need to specialize a few more of the conversion routines to handle such types now, as QJniObject is no longer a base class. To be able to do that we need to add a base class that we can test for, and that has the APIs that don't depend on the template parameter. Since we now need to know about QtJniTypes::JObject(Base) in the conversion routines that are implemented in qjniobject.h, we have to move these base types into that header as well. This reduces the qjnitypes.h header to the macros for declaring types and a few helpers for native methods, which is perhaps how it should be anyway. Pick-to: 6.7 Change-Id: If2052a79a108fdb62ca71c88f4fa04d9f5ea2c4b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* wasm: delay "qtLoaded" qtloader.js eventMorten Sørvig2023-12-182-0/+47
| | | | | | | | | | | | | | | | | | | | | | | Currently we send qtLoaded in response to Emscripten onRuntimeInitialized, which is sent just before or at the time main() is called. This can be too early if Qt (app) initialization is not instantaneous, in which case we risk displaying a blank page in between hiding the loading screen and showing the application. Change this to send qtLoaded when QCoreApplication has finished its constructor and the event loop is running. Also add the possibility of registering startup tasks which can delay sending qtLoaded further. We now require a QCoreApplication (or a subclass) instance for the qtLoaded event. onRuntimeInitialized can be used as a replacement if anyone needs the previous behavior. Change-Id: I9298e881d2909aac4040c5f2068e6c7d196196cc Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Doc: Remove references to Qt 4 in Qt 5.0 in Qt Core documentationKai Köhne2023-12-182-8/+6
| | | | | | | Pick-to: 6.6 6.7 Change-Id: Ide0c1ed441c923753f1e81141460719161662c15 Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
* Debounce QDeferredDeleteEvents in QObject::deleteLater()Tor Arne Vestbø2023-12-152-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to look through the event queue in QCoreApplication::postEvent, and if we found an existing DeferredDelete event for the receiver we would compress the two events into one. This was changed in 99b89d30fa5484c5d1f3cbda828648c28af4fb7d, as the logic was causing O(n^2) for deleteLater, by using one of the bits in QObjectData to track whether the object had already been deleted. But it kept the logic for tracking this in QCoreApplication::postEvent, and QCoreApplication::compressEvent would still do the work of deleting the additional QDeferredDeleteEvents. To avoid the unnecessary heap allocation of the QDeferredDeleteEvents we can move the debouncing/compression to QObject::deleteLater(). We use the same mutex as in QCoreApplication::postEvent to guard concurrent access to deleteLaterCalled. A note has been added about the (preexisting) issue that the mutex is not sufficient to prevent data races, as the deleteLaterCalled flag is part of a bit-field, and we're not guarding any of our other accesses to other bits. As QDeferredDeleteEvents is private API, we can rely on no-one else posting it than QObject::deleteLater(), which should be the case now that tst_QApplication::sendPostedEvents() was fixed. The documentation has been clarified as well. It's safe to call deleteLater() more than once, but that's not _because_ other pending events for the object are cleared. The latter behavior is normal ~QObject() behavior. The documentation was probably written at a point we didn't do any event compression at all for QDeferredDeleteEvents. Task-number: QTBUG-120124 Task-number: QTBUG-119918 Change-Id: I2a733095b7cb066ba494b1335aa40200c749cb0c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* JNI API review: refactor repeated if constexpr-chainVolker Hilsheimer2023-12-152-145/+73
| | | | | | | | | | | | | | Provide class template specializations for each supported JNI type (and also covering the equivalent C++ types), and implement generic call- helpers using the type-specific JNI function. Remove the now unused static-assert helpers for unsupported types. We'll get compile time errors when the functions are used with unknown types. Pick-to: 6.7 Change-Id: I8ae848bb9de60b536df64318c8a65560d8f70acb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* JNI API review: minor API and implementation cleanupsVolker Hilsheimer2023-12-155-51/+60
| | | | | | | | | | | | | | | | - prefix ValidField/SignatureTypes predicates with "If" - make QJniArray SMF constexpr and noexcept - remove const from return-by-value QJniArray functions - rename QJniArray::asContainer to toContainer - constrain QJniEnvironment::registerNativeMethods to valid class types - don't home-grow std::forward - make default QtJniTypes::Object constructor implicit - don't include copy/move constructors in QtJniTypes::Object variadic constructor Pick-to: 6.7 Change-Id: Ied02993d32d8b0f3ef1e571b75ada15ede1f8389 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QObject: remove the operator comma hackThiago Macieira2023-12-141-29/+47
| | | | | | | | It was the easiest way to implement this back in the day without an explosion of combinatorics. Change-Id: Ia930b1a2ed1e465a826ffffd179c5bb4657d0562 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Suppress clang-tidy mem leak warning on QMetaObject::invokeMethodThiago Macieira2023-12-142-0/+2
| | | | | | | | | | | | We don't leak, but clang-tidy is printing this warning. Possibly because it sees a new with no matched delete in the same context, ignoring the fact that the pointer was gifted to the called function. Fixes: QTBUG-119972 Pick-to: 6.7 6.6 6.5 Change-Id: I6e2677aad2ab45759db2fffd17a06c57c3a463ba Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove qDeleteInEventHandlerTor Arne Vestbø2023-12-143-9/+2
| | | | | | | | | | It's equivalent to delete these days, and has been for a long time, since 2011 in fact, when the last remnants of QT_JAMBI_BUILD were removed. Change-Id: I7703e41c04204844da4ee75fa251b361e0db4ead Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMetaType: s/QPair/std::pair/Marc Mutz2023-12-141-17/+14
| | | | | | | | | | | | Also port from qMakePair() to just braced initialization and CTAD. As a drive-by, use auto instead of various const QMetaType::*Function* so statements fit on one line again, and port from `typedef` to `using`. Pick-to: 6.7 Task-number: QTBUG-115841 Change-Id: I6bd9747fb9eb34da08053927507f2008d9bbfb86 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QtCore platform code: s/QPair/std::pair/Marc Mutz2023-12-134-6/+5
| | | | | | | | | Also port qMakePair() to just braced initialization and CTAD. Pick-to: 6.7 Task-number: QTBUG-115841 Change-Id: I46ee214ab47513375a6e28e3b439c7b060581235 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* [docs] QDeadlineTimer: remove docs of a function that exists no moreMarc Mutz2023-12-131-5/+0
| | | | | | | | | | | | | | The _q_data() function was removed before 6.6, but the docs remained. Presumably qdoc doesn't care about non-existing \internal \fn's. Found while hunting for QPair uses to eliminate. Amends eac30fcb827e9bb1372e46290c060c833bd8ea67. Pick-to: 6.7 6.6 Change-Id: I73fdfe69d4158977a6a80eb2a5e790ada09fe85a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QProperty: clean up unnecessary sentinel classPo-Hao Su2023-12-092-5/+14
| | | | | | | | | | Instead of introducing the nested class InheritsQUntypedPropertyData as a sentinel class for inheritance check, we can use BinaryTypeTrait to handle the check. By doing this, we no longer need to maintain the nested class. Change-Id: Ie3aae976015d5fae6b6d072cad6ee52cd30b769d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaType: fix typenameHelper() for types in the QtPrivate namespaceThiago Macieira2023-12-081-5/+8
| | | | | | | | | | | | | | | | | | GCC at some point decided that it wouldn't include the full namespace expansion in __PRETTY_FUNCTION__ for any type that is in the same namespace as the template function being expanded (that is, the QtPrivate) namespace. I don't know how long this behavior has been in place, but it can be seen with GCC 13, where the expansion of that macro inside QtPrivate::typenameHelper<QtPrivate::ModelIndex>() is: constexpr auto QtPrivate::typenameHelper() [with T = ModelIndex] This can be easily worked around by using a different namespace. Fixes: QTBUG-119650 Pick-to: 6.6 6.5 6.2 Change-Id: Ica7a43f6147b49c187ccfffd179df309e43a70cb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add Q_OBJECT_NO_OVERRIDE_WARNING for MSVCJoni Poikelin2023-12-011-0/+2
| | | | | Change-Id: I5fc19c03eae3b7ea1aab83c5e3c978d57970bd25 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename EINTR_LOOP -> QT_EINTR_LOOPMarc Mutz2023-11-303-15/+15
| | | | | | | | | | | | | | | This non-namespaced macro was defined in a header, and while that header is private, we shouldn't define non-namespaced macros in our headers. The macro also clashed with one of the same name defined in forkfd.c, which broke unity-builds including the forkfd_qt.cpp TU. This rename fixes that, too, so we can now remove forkfd_qt.cpp from NO_UNITY_BUILD_SOURCES. Pick-to: 6.6 6.5 Change-Id: Ic4bb4e4d7a632ca87905e48913db788a7c202314 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Fix \fn template arguments for Qt CoreLuca Di Sera2023-11-305-12/+16
| | | | | | | | | Upcoming changes to QDoc require accurate definition for template arguments in \fn commands. Task-number: QTBUG-118080 Change-Id: I64d50919bc6ffab61ef5ead553d1da99d63a9f21 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* wasm: manage wakeUp state correctlyMorten Sørvig2023-11-271-1/+15
| | | | | | | | | | | | | | | | | | | | | | | We were losing wakeups in cases where wakeUp() was called during processPostedEvents(), since wait() was unconditionally resetting m_wakeUpCalled. Fix this by setting m_wakeUpCalled to false before processing posted events, and then checking if it's still false before waiting. We don't hold the mutex while processing events so that can still race with wakeUp() calls, but this should now be harmless since at worst we'll spin and check for posted events one extra time before waiting. Pick-to: 6.6 6.5 Fixes: QTBUG-118416 Change-Id: I0183747c4d1f128bb6a46ba9c68f4eeb4d35a138 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Apple: Use namespaced category name sandbox helperTor Arne Vestbø2023-11-272-2/+2
| | | | | | | Pick-to: 6.6 6.5 Fixes: QTBUG-119338 Change-Id: I8a62b3fff0c1f3de2b6ae3332f6a1ecc7b1561e5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* JNI: remove the environment check in QJniObject againVolker Hilsheimer2023-11-271-54/+5
| | | | | | | | | | | | | | | This amends 944200b5a9705a7617f82cdaf5caf8932380aba4 and the follow-up commit 84e70976f3d3df8ac921877d32c1dd884fd64267. We have too many use cases in Qt where we construct a QJniObject from one thread, and access it from others. Remove the overhead of checking and warning about the mismatches. The responsibility of guarding access to the underlying Java object, by using MonitorEnter/Exit or synchronization blocks in Java, is with the caller. Change-Id: Iadbc9af0476009f2d43ecdd3d8f1335f31a04446 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QMetaEnum: let key(s)ToValue match fully-qualified unscoped enumeratorsAhmad Samir2023-11-261-2/+30
| | | | | | | | | | | | | | | | | | | | For an unscoped enumerator, e.g.: namespace N { class C { enum E { F }; }; }; N::C::F and N::C::E::F are equivalent and key(s)ToValue should match both. This already works for scoped enums because the name of the enum can't be dropped. Fixes: QTBUG-118240 Pick-to: 6.6 Change-Id: I84d7bbb7aa8f82b2a7c2bc7e4edd5d77d37335c4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* wasm: Proxy emscripten_fetch() to the main threadPiotr Wierciński2023-11-221-1/+1
| | | | | | | | | | | | | | Calling emscripten_fetch() on worker thread which never yields control back to the browser, will leave the fetch request pending forever. This can be a problematic for example in QML Loader, which tries to load resource by network. Proxy this function call to the main thread, so it can be processed by the browser. Fixes: QTBUG-118225 Pick-to: 6.6 6.5 Change-Id: I969d73f6a66670c4135960e08d2eedc8d2a6e5c3 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QObject: allow calling findChild() without a nameRym Bouabid2023-11-222-1/+25
| | | | | | | | | | | Add an overload of findChild() without a name argument to be able to call the function with options value only. [ChangeLog][QtCore][QObject] Added findChild() overload taking no name. Task-number: QTBUG-103986 Change-Id: Id06b6041408fcf4cc1eeba975afce03f3a28f858 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QObject: port findChild/ren() to QAnyStringViewRym Bouabid2023-11-222-40/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | Change the object's name type in QObject::findChild/ren() to QAnyStringView, because they are only used for comparison against objectName property. qt_qFindChild{,ren}_helper() functions taking an objectname as QString have to stay in the ABI as they were exported in inline methods before Qt 6.7. Unlike QString, constructing a null QAnyStringView doesn't involve any code-size overhead. So, get rid of the split in qt_qFindChildren_helper that was introduced for QString. Remove unneeded qt_qFindChildren_with_name helper function and qt_qFindChildren_helper overload without a name. findChildren(options) method used to call qt_qFindChildren_helper overload. Instead, call findChildren overload with name argument and pass QAnyStringView{} as the object name. [ChangeLog][QtCore][QObject] Ported QObject::findChild/ren() and their helper functions to QAnyStringView. Task-number: QTBUG-103986 Change-Id: I68bda0e581f984ae48b7581ad86cc1b95008c1b0 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>