summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusconnectionmanager_p.h
Commit message (Collapse)AuthorAgeFilesLines
* QtDBus: Use invokeMethod accepting member functions with argumentsIevgenii Meshcheriakov2023-08-261-2/+2
| | | | | | | | | | | This makes the code slightly more readable. Rename one overload of QDBusConnectionManager::doConnectToBus to avoid using qOverload. Change-Id: Id878e5baade539c3f748b5bf66a5aff726604b89 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDBusConnectionManager: Remove unused member variablesIevgenii Meshcheriakov2023-08-221-3/+0
| | | | | Change-Id: If9e452e81db0fefa10704b83e6447ccef0763b59 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDBusConnectionManager: Move all locking inside the classIevgenii Meshcheriakov2023-08-221-5/+10
| | | | | | | | | Make `mutex` member private and make all former users call new public member functions that perform locking. Make old non-locking member functions private. Change-Id: I29092d1bd785aa6b830183c1c1fe125b16e0d633 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDBusConnectionManager: Use invokeMethod() to create connectionsIevgenii Meshcheriakov2023-08-221-25/+4
| | | | | | | | | Use QMetaObject::invokeMethod() with a lambda instead of setting up a permanent signal/slot connections with BlockingQueuedConnection type. This makes the code flow easier to follow. Change-Id: I0e77433e3fb96f99ed39f2d14dad737d444d3269 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDBusConnectionManager: Use invokeMethod() to create serversIevgenii Meshcheriakov2023-08-211-2/+4
| | | | | | | | | Use QMetaObject::invokeMethod() with a lambda instead of setting up a permanent signal/slot connections with BlockingQueuedConnection type. This makes the code flow easier to follow. Change-Id: Ib6566e7a4694ecbd69900b645d020b3331fb3462 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>
* MetaObject: Store the QMetaType of the methodsFabian Kosmale2020-06-021-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | This does the analog of 46f407126ef3e94d59254012cdc34d6a4ad2faf2 for the methods we care about (signals, slots, Q_INVOKABLEs). In addition to the actual QMetaType, we store an array with offsets so that we later can do a mapping from methodIndex to metatype. The newly added QMetaMethod::{return,parameter}MetaType methods can then be used to retrieve the metatypes. This does however require that all involved types are complete. This is unfortunately not a feasible requirement. Thus, we only populate the metatype array on a best effort basis. For any incomplete type, we store QMetaType::Unknown. Then, when accessing the metatype, we fall back to the old string based code base if it's Unknown. Squashes "moc: support incomplete types" and "Fix compile failures after QMetaMethod change" Fixes: QTBUG-82932 Change-Id: I6b7a587cc364b7cad0c158d6de54e8a204289ad4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* 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>
* Add qtdbusglobal.h and qtdbusglobal_p.hLars Knoll2016-07-141-0/+1
| | | | | | | | | | | | | | The new modular configuration system requires one global header per module, that is included by all other files in this module. QtDBus already had such a header, but its name (qdbusmacros.h) was not in line with what's being used in all other modules. So add a qtdbusglobal.h header, and turn qdbusmacros.h into a a forwarding header to that new global header file. Change-Id: Ib7eb2484c7b8b588eb89bf3290cb6c1c7c391fe2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-211-1/+1
| | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> 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>
* Suspend processing of some messages in the default busses by defaultThiago Macieira2016-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To retain a bit compatibility with applications developed in the last 9 years that expect that QDBusConnections won't process their events until the event loop runs, we now suspend the handling of incoming messages in the two default buses (and only in them) and resume when the event loop starts. This is required because the new threaded QtDBus would otherwise process incoming messages that the application didn't expect it to. For example, if the application first acquires names on the bus and only after that registers objects with QtDBus, there's a small window in which the name is acquired and visible to other applications, but no objects are registered yet. Calls to those objects may be received, would then be processed in the QDBusConnectionManager thread and fail. The work around is to disable the actual handling of method calls and signals in QDBusConnectionPrivate::handleMessage. Instead, those messages are queued until later. Due to the way that libdbus-1 works, outgoing method calls that are waiting for replies are not affected, since their processing does not happen in handleMessage(). [ChangeLog][Important Behavior Changes] QtDBus now uses threads to implement processing of incoming and outgoing messages. This solves a number of thread safety issues and fixes an architectural problem that would cause all processing to stop if a particular thread (usually the main thread) were blocked in any operation. On the flip side, application developers need to know that modifications to a QDBusConnection may be visible immediately on the connection, so they should be done in an order that won't allow for incomplete states to be observed (for example, first register all objects, then acquire service names). Change-Id: I39cc61d0d59846ab8c23ffff1423c6d555f6ee0a Reviewed-by: David Faure <david.faure@kdab.com>
* Merge two Q_GLOBAL_STATICS into another and solve memory leakThiago Macieira2015-09-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | The two global statics for the session and system buses aren't necessary if they can't outlive the global static for QDBusConnectionManager anyway. So merge them there. The extra mutex is necessary because the QDBusConnection::connectToBus function will lock the regular mutex. This solves a potential memory leak at exit as a side-effect. Before this change, the session and system QDBusConnection object got destroyed in the main thread during global destruction, so it had to post an event to the QDBusConnectionManager thread to finish the destruction of the private. However, QCoreApplication is already gone by this point, so the QEvent::DeferredDelete event never got delivered. After this commit, there's no global static to destroy the QDBusConnection (there is no QDBusConnection holding a reference), so the object gets destroyed in QDBusConnectionManager::run()'s cleanup code. Change-Id: I9a75ad8521ae4e5cbbe5ffff13d1b967ee1a7a7e Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* And move the creation of connections to the threadThiago Macieira2015-09-151-0/+11
| | | | | | | | | | Now we know that all timers and socket notifiers get created only in the QDBusConnectionManager thread. Incidentally, this reduced code duplication. Change-Id: I27eaacb532114dd188c4ffff13d5075a8d2efb0b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Use a dedicated thread for handling incoming libdbus-1 eventsThiago Macieira2015-09-151-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Each application will have one thread dedicated for this, for all QDBusConnections. I wouldn't mind sharing such a thread with other uses in Qt, provided none of them ever block (the QProcessManager thread comes to mind, but it's going away soon). The cost associated with this change in this commit is so far rather minimal. All incoming D-Bus calls need to be handled after an event is posted anyway, to avoid deadlocking on reentering libdbus-1 functions that acquire locks still held. The cost is the one more thread running and the cost of synchronizing them when an event is posted. The benefits far outweigh that cost: no longer will we have problems of QtDBus failing to run if the main system or session connections are used before QCoreApplication is run. Moreover, events can be received and handled in aux threads even if the main thread is blocked on some operation. Note: this commit may not be testable (tst_qdbusconnection may fail) Task-number: QTBUG-43585 Change-Id: Ic5d393bfd36e48a193fcffff13b737556ccd11a8 Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@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>
* Remove the old QDBusConnection::sender functionalityThiago Macieira2015-01-061-3/+0
| | | | | | | | | | | | | This has been deprecated since QDBusContext was introduced (Qt 4.3). So it's time to remove the functionality. [ChangeLog][Important Behavior Change] QDBusConnection::sender() (deprecated since Qt 4.3) has changed to always return an invalid QDBusConnection. To know what connection the incoming call was received from, use QDBusContext. Change-Id: I355efb82c14e54ed718c8f892d8267e727b19118 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+88
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12