summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread_p.h
Commit message (Collapse)AuthorAgeFilesLines
* QThread: Introduce isCurrentThreadFabian Kosmale13 days1-0/+1
| | | | | | | | | | This allows a more efficient way of checking whether a thread is the currently executing one (without using private API). Change-Id: I007edae6b258d7e42e901fa720d4f3cf9fe25a49 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* Add categorized logging of delete later machineryTor Arne Vestbø2023-12-211-5/+2
| | | | | | | | | 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>
* tst_QThread: Unbreak UBSan buildMarc Mutz2023-07-131-1/+1
| | | | | | | | | | | | tst_QThread peeks into QThreadPrivate, which means that a UBSan build needs access to QThreadPrivate's type_info, for which we need to export the class. Amends 268ff00ef50a74ffa58e53c2c8897b7a7319be41. Pick-to: 6.6 6.5 Change-Id: Ic26df3d323d50b51d369d5f2bd78db7e047b5341 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix improper ELF versions of two more classesThiago Macieira2023-01-061-0/+1
| | | | | | | | | | | | They got marked as Qt6_PRIVATE_API because of these ARE private classes, however their pointers are used in user code. For QMutexPrivate, because we manipulate the pointer in inline code; for QPostEventList, because it's used in a virtual member function's parameter list. Pick-to: 6.5 Fixes: QTBUG-109605 Change-Id: I69ecc04064514f939896fffd1736d1fa8d3f1768 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QThread: Clean up bindingStatusOrList if object gets deletedFabian Kosmale2022-07-141-0/+3
| | | | | | | | | | | | Deal with the case that the object gets deleted between a call to moveToThread and the start of the thread by removing the object from the list in that case. Fixes: QTBUG-104014 Pick-to: 6.4 Change-Id: Ib249b6e8e8dfbc4d1332bb99a57fa9d3cff16465 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPostEventList: de-inline addEvent()Marc Mutz2022-06-221-17/+1
| | | | | | | | | | | While in a private header, it did manage to place QList<QPostEvent> operations near the top spots of all Qt template instantiations in a QtWidgets build. Task-number: QTBUG-97601 Pick-to: 6.4 Change-Id: I4fa1972b8764b71ad0559633131e7e44b3d4ae6a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Optimize QThreadPrivate::addObjectWithPendingBindingStatusChange()Marc Mutz2022-05-261-6/+9
| | | | | | | | | | | | | | | | | | | | | ... and bindingStatus() QBindingStatus* is the final state of the value chain in m_statusOrPendingObjects, so we can use the Double-Checked Locking Pattern to avoid locking the mutex when we already have a status - it won't go away again, unlike the vector in the List state. To enable the change, make the data member an atomic<>. All loads and stores can continue to use memory_order::relaxed, except the loads of a potential status, which have to acquire, and the store of the status, which has to release. This creates the necessary synchronizes-with relation. So even though we synchronize out of middle of the mutex critical section in QThread::exec() this way, there's no data race between QThread::exec() and a potential bindingStatus() call. Change-Id: I0e0b7bd305649fa5f56a0f8723fb75f2577b90dd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix race conditions in moveToThreadFabian Kosmale2022-05-241-24/+82
| | | | | | | | | | | | | Amends ba6c1d2785ca6d8a8b162abcd9d978ab0c52ea2d, which made m_statusOrPendingObjects already atomic, but did not handle concurrent deletion/push_back of the pendingObjects vector correctly. We use the existing lock in QThreadPrivate to prevent data races. Pick-to: 6.2 6.3 Fixes: QTBUG-101681 Change-Id: I0b440fee6ec270d762e6700a4fe74f28b19e75e8 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QCoreApplication/QPostEventList: fix int/qsizetype mismatchesMarc Mutz2022-05-191-2/+2
| | | | | | | | | | | | Includes fixes in indexed for loops that are either known to modify the container under iteration, or else aren't known not to do it, so were kept as indexed loops, instead of being ported to ranged ones. Pick-to: 6.3 6.2 Task-number: QTBUG-103532 Change-Id: I7047b6127fbc4ac16ee113cfd6d1c71f2caba1e7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QObject: Turn flaggedSignatures into a thread_local staticMarc Mutz2022-05-171-21/+0
| | | | | | | | | | | | | | | | | | | | ... out of QThreadData. No-one except two functions in qobject.cpp uses the object, and its creation is constinit, so there's no advantage to expose it to the world as a QThreadData member. Remove it from QThreadData, move the class' definition to the unnamed namespace in qobject.cpp, ensure constinit'ability by letting the language zero out the members (as opposed to an STL algorithm call), declare it constinit thread_local static, and adapt the two users (basically, removing the retrieval of QThreadData::current()). Almost no effect on Clang, but saves ~400 bytes on optimized GCC 11.2 Linux AMD64 C++20 builds. Change-Id: I22432d4ec5eb4ab59920656409b21768983fb4db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QProperty: fix threading issuesFabian Kosmale2022-03-101-0/+33
| | | | | | | | | | | | | | | | | | | | QObject's cache the binding status pointer to avoid TLS lookups. However, when an object is moved to a different thread, we need to update the cached pointer (as the original thread might stop and thus no longer exist, and to correctly allow setting up bindings in the object's thread). Fix this by also storing the binding status in QThreadPrivate and updating the object's binding status when moved. This does only work when the thread is already running, though. If it is not running, we instead treat the QThreadPrivate's status pointer as a pointer to a vector of pending objects. Once the QThread has been started, we check if there are pending objects, and update them at this point. Pick-to: 6.2 6.3 Fixes: QTBUG-101177 Change-Id: I0490bbbdc1a17cb5f85044ad6eb2e1a8c759d4b7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Don't access QObject::objectName during QThread startVolker Hilsheimer2022-01-121-0/+7
| | | | | | | | | | | | | This is a data race, as the thread accesses QObject::objectName on the QThread instance while the thread owning the QThread might modify the objectName. Instead, make a copy in the QThreadPrivate that can be accessed safely. Task-number: QTBUG-96718 Pick-to: 6.3 6.2 5.15 Change-Id: I10701551d498993ca5055daf161636bfb648840c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QThread: fix UB (invalid enum value) on Private::PriorityMarc Mutz2022-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | | The Unix code stores an additional flag, ThreadPriorityResetFlag, in the Policy enum, but ubsan does not approve: qthread_unix.cpp:303:30: runtime error: load of value 2147483648, which is not a valid value for type 'Priority' qthread_unix.cpp:304:75: runtime error: load of value 2147483648, which is not a valid value for type 'Priority' Fix by making the variable of std::underlying_type_t<Priority>. The masking and unmasking code can now be simplified, too. In the Windows version, replace some switch targets with equivalent ones to keep -Wswitch-like warnings, though I hasten to note that both switches use a default case, so have anyway implicitly disabled said warning. Pick-to: 6.3 6.2 5.15 Change-Id: Ie4ea7d05e2928d2755ad12d36535197f85493191 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QThreadPrivate: Remove threadForIdFabian Kosmale2021-09-221-3/+0
| | | | | | | | | The thread build variant is not implemented; the no-thread one simply returns the current thread. As this has no utility at best and misleading at worst, remove those functions. Change-Id: I93ee45ae7d55e3a7ad1f03168b14149a5d4c9253 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-301-1/+1
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Whitespace cleanup in corelib/ mimetypes, plugin and threadAllan Sandfeld Jensen2020-10-211-4/+6
| | | | | | | Done with selective application of clang-format Change-Id: Iee6bf2426de81356b6d480629ba972f980b6d93d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use QList instead of QVector in corelibJarek Kobus2020-06-251-7/+5
| | | | | | | | | | Applied to headers only. Source file to be changed separately. Omitted statemachine for now to avoid conflicts. Omitted qmetatype.h for now - to be handled later. Task-number: QTBUG-84469 Change-Id: I317376037a62467c313467d92955ad0b7473aa97 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Remove winrtOliver Wolff2020-06-061-13/+0
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-2/+2
| | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-06-141-0/+3
|\ | | | | | | | | | | | | | | | | | | Conflicts: qmake/generators/makefile.cpp qmake/generators/unix/unixmake2.cpp src/corelib/thread/qthread_unix.cpp tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp Change-Id: I1df0d4ba20685de7f9300bf07458c13376493408
| * wasm: make idealThreadCount() work on all threadsMorten Johan Sørvig2019-05-081-0/+3
| | | | | | | | | | | | | | | | | | navigator.hardwareConcurrency can be accessed from the main thread only. Read and cache the value on QCoreApplication initialization. Change-Id: I731f7f356ce106c7107977783d4b763326af06b6 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-031-2/+2
| | | | | | | | | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | More nullptr usage in headersKevin Funk2019-03-141-6/+6
|/ | | | | | | | | | | Diff generated by running clang-tidy's modernize-use-nullptr checker on the CMake-based Qt version. Skipping src/3rdparty, examples/, tests/ Change-Id: Ib182074e2e2fd52f63093f73b3e2e4c0cb7af188 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* winrt: Explicitly set main thread in QCoreApplication's constructorOliver Wolff2018-10-081-0/+3
| | | | | | | | | | | | | | | For winrt we cannot rely on the fact, that QThread::current will be called from the correct thread for the first time. The application's main entry point creates a suspended thread and starts it right afterwards. At that moment, other functionality (QLoggingRegistry for example) might have called QThread::current, which set the wrong thread as the main thread. In order to avoid this situation, the main thread is explicitly set in QCoreApplication's constructor. Task-number: QTBUG-66418 Change-Id: I8b6347357a80eb395ae758bd3d420adef0826751 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge QThread class definitionsMorten Johan Sørvig2018-08-171-0/+1
| | | | | | | | | We can reuse the main QThread definition for the no-thread configuration and avoid having to keep them in sync. Add stub definitions for member functions where needed. Change-Id: I128db11684a6040d09c4a4ce114f1399cba523f8 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Modernize the "thread" featureUlf Hermann2018-08-171-4/+6
| | | | | | | | | | Add it to configure.json and replace all occurrences of QT_NO_THREAD with QT_CONFIG(thread). Add conditions for other features that depend on thread support. Remove conditions where we can use the QMutex and QThreadStorage stubs. Change-Id: I284e5d794fda9a4c6f4a1ab29e55aa686272a0eb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QThread: Centralize the creation of the event dispatcherThiago Macieira2018-07-141-1/+9
| | | | | | | | | | | In some places we call startingUp(), in others we don't. It's probably ok for those that have just created an object of a given class, which knows whether the virtual call is necessary or not. But for the generic case, we do call it. Change-Id: If48c5c2e920c433298f1fffd153ee1cc75703204 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make the stub implementation of QThread compile againUlf Hermann2018-06-221-2/+5
| | | | | | | | | | | | | | | | We cannot inline methods of QThreadPrivate because QThreadData has to be declared before. The global QThreadData needs to be accessible to QThreadData::clearCurrentThreadData(), and QAdoptedThread::run() has to be moved inside the #ifndef QT_NO_THREAD block as run() doesn't exist in the stub and Q_DECL_OVERRIDE would be wrong. We also fix the QThreadData::current() method to take and use the same parameters as in the non-stub case. Change-Id: Id29ca44b11fa95ed2df7cc39243a07ce7d3c455e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Make QThreadPrivate::createEventDispatcher do exactly what it saysTor Arne Vestbø2018-02-141-2/+2
| | | | | | | | | | | Leaving the logic of starting up the event dispatcher to the call site, unified both the case of a custom event dispatcher and the default event dispatcher. The data argument is left in due to the static nature of the function. Change-Id: Ia2020e39ccc67cd5a583d4e614dd978b2ec44dba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Optimize QThread::isInterruptionRequested()Marc Mutz2017-11-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To signal a thread to cancel, nothing more than a std::atomic_flag is needed, but the implementation actually used mutexes, and weird run-state introspection, so we can't just swap it out for a std::atomic_flag. Instead, we retain the principal logic, however weird it is, and just optimize the common case where isInterruptionRequested() is called from the secondary thread, repeatedly. We add a fast-path that just checks that d->interruptionRequested is not set. That requires nothing more than a relaxed atomic load, because there's no new value read that could be used as a signal to the secondary thread that some condition changed. "What signal?", you may ask. Well, one can think of users doing this: void cancel() { m_why = tr("&Canceled"); requestIterruption(); } void run() override { while (!isInterruptionRequested()) { doWork(); } emit progress(100, 100, m_why); } We need to keep this code working, at least until Qt 6. But the code can already now only rely on synchronization if isInterruptionRequested() returns true. If it returns false, then requestInterruption() has not been called, yet, and any modifications done prior to the requestInterruption() call are not visible in the secondary thead. So we still lock the mutex, and in general don't change the semantics of the functions, except that we don't lock the mutex in the case where the flag wasn't set in the first place. This makes calling isInterruptionRequested() as cheap as it can get, assuming a lock-free implementation, of course. I opted to use a std::atomic<bool> instead of QAtomicInt, as the latter does not have loadRelaxed()/storeRelaxed(), and because it future-proofs the code. Change-Id: I67faf36b8de73d2723f9cdd66c416010d0873d98 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Replace Q_DECL_OVERRIDE with override where possibleKevin Funk2017-09-191-1/+1
| | | | | | | | | | | | | | | | Remaining uses of Q_DECL_OVERRIDE are in: src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.cpp doc/global/qt-cpp-defines.qdocconf (definition and documentation of Q_DECL_OVERRIDE) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QThread: terminate on exceptions leaving run()Giuseppe D'Angelo2017-04-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Align ourselves to the Standard Library and call std::terminate if an exception leaves the thread entry point (that is, run()). On platforms using pthreads, thread cancellation needs to be taken in special consideration, since it looks like it was supported before. On Glibc, and when using C++, pthread_cancel and pthread_exit are implemented by throwing a special kind of exception that can be caught, but must always be rethrown. That exception is then used to activate the cancellation clean-up handlers. (This is non-Standard C++ behavior.) So: mimic what libstdc++'s std::thread does to support Glibc's pthread cancellation. At this time, it looks like libc++ has no support for this, and when used in combination with Glibc a thread cancellation results in a crash (also because it does not seem to terminate() when exceptions leave the thread). [ChangeLog][QtCore][QThread] An exception escaping from QThread::run() will now result in immediate and abnormal program termination. The same applies if an exception leaves a slot connected directly to the QThread::started() or QThread::finished() signals. Change-Id: I73cc93cf06c57018e149a578cc9d4cd0d6fc00ef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Turn QThreadData::threadId into a QAtomicPointerThiago Macieira2017-02-151-1/+1
| | | | | | | | | | | Solves a data race found by TSan. Since thread and threadId are QAtomicPointer, I've removed the explicit initialization in the QThreadData constructor Task-number: QTBUG-58855 Change-Id: I4139d5f93dcb4b429ae9fffd14a34082f2683f76 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-061-1/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/qtestlib/tutorial5/containers.cpp examples/widgets/tools/tools.pro src/corelib/io/qprocess.cpp src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/network/kernel/qdnslookup_unix.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp tools/configure/configureapp.cpp Change-Id: I838ae7f082535a67a4a53aa13a21ba5580758be8
| * Don't store the pthread_t thread ID twice in QThreadThiago Macieira2016-04-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was being stored once in QThreadPrivate and once in QThreadData, with the latter being hidden as a Qt::HANDLE. Besides saving a little bit of memory, this also solves a small data race condition that arises from trying to connect a signal to an object moved to that thread and then emit that signal shortly after the thread starts. Before this patch, QThreadData::threadId was initialized only by QThreadPrivate::start(), which meant that we were racing that initialization with this check in QMetaObject::activate: const bool receiverInSameThread = currentThreadId == receiver->d_func()->threadData->threadId; Task-number: QTBUG-52337 Change-Id: Ifea6e497f11a461db432ffff1449ae01f1099aae Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | CoreLib: use const (and const APIs) moreAnton Kudryavtsev2016-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | For CoW types const methods will be called. Mark store_persistent_indexes() as const, because this method does not modify the object. Change-Id: Ic867913b4fb5aaebfbaaffe1d3be45cf7b646403 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix for deferredDelete() bug when calling the glib loop directlyPaolo Angelelli2016-02-121-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes sure that all events posted using Qt on top of the GLib event loop have the loopLevel counter incremented. This is done since Qt depends on the fact that all deleteLater() calls are issued within the scope of some signal handler (in other words, triggered by the chain sendEvent() -> notifyInternal2()). There is a side effect though: in the conditions affected by this patch, that is deleteLater()s issued within a glib event handler for example, manually calling processEvents() or sendPostedEvents() with or without the QEvent::DeferredDelete flag has the same effect, and deferred deleted events are always processed. While this is not a currently working feature which the patch breaks, this side effect seems to be difficult to avoid without separating sendPostedEvents() and processEvents() into a public and a private method, in order to detect when they are manually called. Such change could perhaps be done for Qt6. An autotest for QTBUG-36434 is also included. Autotesting for QTBUG-32859 seems to be more challenging in this respect, due to its dependency on GLib. Task-number: QTBUG-18434 Task-number: QTBUG-32859 Task-number: QTBUG-36434 Change-Id: Ib89175aa27c9e38bca68ae254d182b2cd21cf7e9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
| * Fix two data races in QThread/QThreadDataDavid Faure2015-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * theMainThread is written by the main thread and read by QThreadData::~QThreadData() (any managed thread) * QThreadData::thread is written by QThread::~QThread (in the parent thread) and read+written by QThreadData::~QThreadData (in the managed thread). This can happen because QThreadData is refcounted so the managed thread (which derefs it) races with the parent thread (which sets it to 0). Change-Id: I72de793716391a0937254cda6b4328fcad5060c7 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Add a way for auxiliary threads to handle events without CoreAppThiago Macieira2015-07-181-1/+9
|/ | | | | | | | | | | | | | Long-lived threads started by Qt itself can now receive events even if QCoreApplication hasn't been created. This is required in all threads we start that will handle events, unless we're sure that the thread will exit before the global application object begins destruction. Otherwise, those threads will have race conditions dealing with the event delivery system trying to call the QCoreApplication::notify() virtual while the object is being destroyed. Change-Id: I27eaacb532114dd188c4ffff13d4ad2a4bb443e6 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Use qthread_win.cpp for WinRT as wellOliver Wolff2015-06-231-9/+0
| | | | | | | | | | Since of Windows (Phone) 8.1 most of the desktop's thread functionality is also available, so we might be able to share the code and get rid of the extra implementation for WinRT. Task-number: QTBUG-43837 Change-Id: I0ce907cd94899834527f88c70e1e395bafdb14b3 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
* WinRT: fix namespaced buildJoerg Bornemann2015-05-161-4/+10
| | | | | Change-Id: I0505523a5524995e374dc8f005f101d0cea8b01e Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Add Q_DECL_OVERRIDE in the src subdirectoryOlivier Goffart2014-12-031-1/+1
| | | | | | | | | | Done automatically with clang-modernize on linux (But does not add Q_DECL_OVERRIDE to the function that are marked as inline because it a compilation error with MSVC2010) Change-Id: I2196ee26e3e6fe20816834ecea5ea389eeab3171 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* winrt: Use native threadingAndrew Knight2014-06-251-10/+13
| | | | | | | | | | | | | | | | | Instead of using std::thread, use the WinRT ThreadPool to manage threads. This allows for setting the scheduling priority, and provides a path to enable XAML integration (which requires Qt run on a background thread). QThread::terminate() is still unsupported, and only the winmain thread can be adopted due to the behavior of the thread pool when creating tasks from the GUI thread. The associated tests are now skipped, and all other QThread tests pass. Task-number: QTBUG-31397 Change-Id: Ib512a328412e1dffecdc836bc39de3ccd37afa13 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>