summaryrefslogtreecommitdiffstats
path: root/src/dbus
Commit message (Collapse)AuthorAgeFilesLines
* Fix QtDBus deadlock inside kded/kiodThiago Macieira2016-03-192-10/+33
| | | | | | | | | | | | | | | | | | | Whenever a message spy was installed, we failed to actually process looped-back messages by queueing them for processing by the spy. That had as a consequence that the caller got an error reply. Worse, since the message had been queued, QtDBus would attempt to deliver it later. Since that message had isLocal==true, bad things happened inside the manager thread. The correct solution is not to queue the message for the filter. If the message is local, then simply deliver directly, as we're still in the user's thread. This used to be the behavior in Qt 5.5. Task-number: QTBUG-51676 Change-Id: I1dc112894cde7121e8ce302ae51b438ade1ff612 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Jan Kundrát <jkt@kde.org>
* Merge remote-tracking branch 'origin/5.6.0' into 5.6Frederik Gladhorn2016-03-171-2/+2
|\ | | | | | | Change-Id: Iac8ff05cd76cbacf859138a73e8e2ed0a979c75a
| * Fix crash when a standard bus isn't availableThiago Macieira2016-02-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Commit 1f6fa1f37a14742ddf53c753ce52d9dc048cd1dc added a way of suspending delivery of messages to standard buses when they connect and resuming delivery when the main loop starts. As a side-effect, we caused an attempt to do dispatching even after the connection failed. The D-Bus library doesn't like that. Task-number: QTBUG-51299 Change-Id: I0c94a5c2846b48c8aea7ffff143564f7fcede890 Reviewed-by: David Faure <david.faure@kdab.com>
* | consistently put {qt,qml}_{module,plugin} at the end of project filesOswald Buddenhagen2016-03-071-2/+2
|/ | | | | | | | this fixes static builds by ensuring that all dependencies are exported. Task-number: QTBUG-51071 Change-Id: Icbce502dcbcb4d4b4d922c42679f44e2cc930bf3 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* Fix dbus wince buildAndreas Holzammer2016-02-053-0/+11
| | | | | | | | | | | interface is a define under wince. This define is included even with standard header includes already. It needs to be undefined for using it. Task-number: QTBUG-50853 Change-Id: Ie44681f03709848e9747a8aec11835c8d62aa409 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QT_DEPRECATED_SINCE usageJędrzej Nowacki2016-02-021-1/+1
| | | | | | | | The deprecation was introduced in 5.6 Change-Id: Ief6b749b40ec75c3c9f904caed8447bfb5ef5439 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QtDBus: Remove unnecessary #ifndef for QT_NO_PROPERTIESThiago Macieira2016-01-301-2/+0
| | | | | | | | qfeatures.txt says that it depends on PROPERTIES, so this condition will never happen. Change-Id: I42e7ef1a481840699a8dffff1409e2e63c6857fa Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Call out to QtDBus message spies in the main threadThiago Macieira2016-01-253-13/+57
| | | | | | | | | | | | | | | | | | | | | Whenever there are spies installed, we call out to the main thread to call to the kded/kiod message spies. This allows the spy code to do just about anything, where previously it was restricted in what it could do to avoid deadlocking or triggering assertions if it recursed back into QDBusConnection code in the manager thread. After the spies are done, the message is re-inserted into the QDBusConnection processing pipeline. This commit moves the spy handling to after the check for disabled dispatching, as doing otherwise would mean the message could get postponed again for no good reason. It's also possible that the main thread isn't done installing the hooks, so waiting until the dispatching is enabled is a good idea. For simplicity, this commit also restricts spying to method calls only. Signals are no longer spyable. Change-Id: I3d11545be52c43119f0fffff142b0e9d447415c2 Reviewed-by: David Faure <david.faure@kdab.com>
* Revert "dbus: Print out 'serial' and 'serial reply to' with DBusMessage ↵Thiago Macieira2016-01-112-10/+4
| | | | | | | | | | operator<<." This reverts commit d3fe4f066f70bc8e4aef06b963444ecdbc3dd00f. Required to revert the parent commit. Change-Id: I1039e2ee65c0cd2c3209ea18bd3bd2d84a8daef3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "dbus: Add method serial() and replySerial() to class DBusMessage."Thiago Macieira2016-01-114-47/+0
| | | | | | | | | This reverts commit 618e2cc081e09d9222418bd933876224675a7530. The original commit has a section of code that I failed to review properly and is of questionable functionality. Change-Id: I61c53d7b8b2aa7c3312292b017a18aba7da11bc5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Work around GCC 6 warning about offset outside bounds of stringThiago Macieira2016-01-081-2/+2
| | | | | | | | | | | | | | This is a false positive because the only offset that can be outside the bounds was the last one (-1), which could not be reached in this line because of the qBound on the line before limiting the maximum value. The -1 wasn't generated by the Perl script embedded in the file anyway. qdbuserror.cpp:142:64: error: offset outside bounds of constant string [-Werror] Change-Id: I24a735698d3c4a719fc9ffff1425f8aad5e5978e Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
* dbus: Print out 'serial' and 'serial reply to' with DBusMessage operator<<.Ralf Habacker2016-01-072-4/+10
| | | | | | | | | | | | The reply serial is displayed for method call returns and errors, while the serial is displayed for all message types. To see a message serial it is required to dump messages after sending, not before. Task-number: QTBUG-44490 Change-Id: I859f50d739ed059d5b2dfe1a2efdf04b906891a7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* dbus: Add method serial() and replySerial() to class DBusMessage.Ralf Habacker2016-01-074-0/+47
| | | | | | | | | | | | | This patch includes setup of class member 'msg' in QDBusMessagePrivate::toDBusMessage() to be able to get the serial after message sending. Testcases for comparing the 'reply serial to' with the 'serial' are included. Task-number: QTBUG-44490 Change-Id: Iae7c48f5b0c70a6c5ae500904072b38b46dfd876 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Suspend processing of some messages in the default busses by defaultThiago Macieira2016-01-025-7/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add a default argument to QDBusPendingCallWatcher::finished signalThiago Macieira2016-01-021-1/+1
| | | | | | | | So we can do connect(&watcher, SIGNAL(finished()), receiver, SLOT(foo())); Change-Id: I39cc61d0d59846ab8c23ffff14241d33fecf2d53 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Remove unused member variable QDBusConnectionPrivate::timeoutsPendingAddThiago Macieira2016-01-021-2/+0
| | | | | | | | They're never pending, since we add them immediately since commit 186d8814407ccb3e221537d9797172c37127bc51. Change-Id: I39cc61d0d59846ab8c23ffff14241be6785ad5a0 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Change a QList of pointers to QVectorThiago Macieira2015-12-291-1/+1
| | | | | | | | | | | QList of pointers is optimum, but QVector should provide the same performance (we aren't using the beginning-of-list feature that QList has and QVector doesn't). But since we're using QVector elsewhere, this should be better. Change-Id: I39cc61d0d59846ab8c23ffff14241c6715e2eb00 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Doc: Update examplesinstallpath to include the repository nameTopi Reinio2015-10-211-1/+1
| | | | | | | | | | | | The examplesinstallpath variable in .qdocconf files defines the path under QT_INSTALL_EXAMPLES where examples are found. To match the way examples are packaged in Qt 5.6, prefix each install path with the repository name. Task-number: QTBUG-48736 Change-Id: I6a35c94fdacaad21cd044411aba02027b9019300 Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
* QDBusServer: Fix uninitialized memberThiago Macieira2015-10-151-4/+2
| | | | | | | | | | If you used the QString constructor overload and passed an empty address, the d pointer would remain uninitialized. Found by Coverity, CID 11724. Change-Id: I42e7ef1a481840699a8dffff1407ead3ee703d6e Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QDBusConnection: Remove unused membersThiago Macieira2015-10-151-3/+0
| | | | | | | I can't find any use, ever, of them. Change-Id: I42e7ef1a481840699a8dffff1407eb1a93b128a8 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QDBusPendingCall: Remove unused memberThiago Macieira2015-10-152-2/+0
| | | | | | | | We set it to the number of types that the call expects to receive, but we never used it anywhere else. Change-Id: I42e7ef1a481840699a8dffff1407eb520b5844d8 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Fix crash in QMetaProperty::write for custom types and conversionOlivier Goffart2015-10-091-0/+3
| | | | | | | | | | | | | | | | if t >= QMetaType::User, we would not return false nor call convert. We would then pass a pointer to whatever is in the QVariant to the qt_metacall that is expecting a pointer to an object of a different type. Since we have custom converters, we can call QVarent::convert even for custom types anyway. [ChangeLog][QtCore] Fixed crash when setting a QVariant of a different type to a property of a custom type. Attempt to do a conversion instead. Task-number: QTBUG-40644 Change-Id: Ib6fbd7e7ddcf25c5ee247ea04177e079f6d7de35 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Fix documentation of new methodLars Knoll2015-10-081-2/+2
| | | | | Change-Id: I7accaac765f5514b67279b640de7f98c8042c35a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: replace \target with \keyword if at start of pageNico Vertriest2015-10-021-1/+1
| | | | | | | | | | | | | A \target whose purpose is to link to the top of a page (and not to a section within a page) works better as a \keyword, because \target generates a new html anchor which, in this case, is not tied to any title element on the page. A \keyword links to the page itself, as expected. Task-number: QTBUG-48482 Change-Id: I957551edd0eb7e665358d04b37dab41e2686b851 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Fix missing "We mean it" in qtbase private headersThiago Macieira2015-10-011-0/+11
| | | | | Change-Id: I42e7ef1a481840699a8dffff1408dfd4fd9c8e32 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Fix deadlock on disconnectNotify() called from ~QObjectThiago Macieira2015-09-253-13/+55
| | | | | | | | | | | | | | | | | | | | | | | | | Normally, disconnectNotify() is called at the end of QObject::disconnect and all the locks have been dropped. That is not the case for the QObject destructor, so we need to deal with the fact that it there may be some locks held. I didn't catch this issue during testing because it depends on the pointer addresses of the object being destroyed and that of the QDBusAbstractInterface sender object, as we use one global, non- recursive mutex pool. For the same reason, this patch is not testable. The fix is simple: we don't need to remove the relay rules immediately. It's ok for them to happen later, since the worst case scenario is that we'll receive a few more signals than we have objects to deliver them to. If that happens, we'll do a little more work than we have to. But in the normal case, the amount of work is the same and we get the benefit of returning more quickly from the destructor. What's more, if the QDBusAbstractInterface object also gets destroyed, the events are deleted and QDBusConnectionPrivate will clean everything up. Task-number: QTBUG-48410 Change-Id: I42e7ef1a481840699a8dffff1406b789ba5217b3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QtDBus: update debugging info (QDBUS_DEBUG=1)Thiago Macieira2015-09-241-10/+4
| | | | | Change-Id: I9a75ad8521ae4e5cbbe5ffff13d1a740643ec22e Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge two more QDBusConnectionPrivate members into a unionThiago Macieira2015-09-152-15/+18
| | | | | | | | | | | QDBusConnectionPrivate can only be a client or a server, not both, so the DBusServer and DBusConnection pointers can be shared, like the QDBusConnectionInterface and QDBusServer pointers in the other anonymous union. Change-Id: I9a75ad8521ae4e5cbbe5ffff13d1baa8ab83c42f Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Make sure we don't deadlock when connecting signalsThiago Macieira2015-09-153-51/+40
| | | | | | | | | | | | This commit moves the code that finishes the signal-slot connection into the QtDBus auxiliary thread. That is necessary because we're holding the lock for writing while making blocking calls. The auxiliary thread might be waiting for us to release that lock while processing some previous message. Change-Id: Iee8cbc07c4434ce9b560ffff13d0521b94a51833 Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Bypass connectSignal() for receiving the NameOwnerChanged signalThiago Macieira2015-09-151-6/+17
| | | | | | | | | | | | | | | | | This is an optimization but is required. Instead of going through the entire (dis)connectSignal() stack to add/remove matching rules for the NameOwnerChanged bus signal and call into our serviceOwnerChangedNoLock slot, create a static hook that will match the signal and simply add/ remove the rules as needed. The required part is that this avoids a recursion into connectSignal(). The next commit will move this code to the QtDBus manager thread and we won't be able to call connectSignal() from there (it would create a deadlock). Change-Id: Iee8cbc07c4434ce9b560ffff13d074ce90ad02d4 Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Make QDBusConnectionPrivate::getNameOwnerNoCache work in our threadThiago Macieira2015-09-151-3/+15
| | | | | | | | | | | | | | | In two commits, we will attempt to call this function from the manager thread, so we need to be sure this function works from there. Right now, it would deadlock in QDBusPendingCallPrivate::waitForFinished(), inside QDBusConnectionPrivate::sendWithReply(). The solution is simple: expand sendWithReply to the sendWithReplyAsync function it calls anyway, but tell the internal DBusPendingCall to finish before we call waitForFinished(). Change-Id: Iee8cbc07c4434ce9b560ffff13d0749013d771ab Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Use the new QDBusConnectionPrivate::shouldWatchService functionThiago Macieira2015-09-151-3/+1
| | | | | | | | | That function was added in the previous commit, so deduplicate the code from QDBusAbstractInterfacePrivate::initOwnerTracking(). Change-Id: Iee8cbc07c4434ce9b560ffff13d06f1d9fb0cde5 Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QDBusServiceWatcher: Move the logic to QDBusConnectionPrivateThiago Macieira2015-09-154-37/+80
| | | | | | | | | | | With kdbus, we won't have a regular signal, but instead a special message. So keep the logic of what to do in QDBusConnectionPrivate. The #ifdef is to make sure the bootstrapped qdbuscpp2xml continues to build in cross-compilation environments. Change-Id: Iee8cbc07c4434ce9b560ffff13d06f0d9904cb6d Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Remove the event callbacks in QDBusConnectionPrivateThiago Macieira2015-09-153-149/+19
| | | | | | | | | | | | | | | | | | | | | They were used when we called the libdbus-1 message-sending functions from any thread, which meant that the callbacks could be triggered on any thread. Since we moved the message-sending to one thread only (the manager's thread), there's no need for the event fallback anymore. Since they're also always[*] running on an aux thread, there's no point in checking for the presence of a QCoreApplication instance anymore. I don't think there has been a need for this for many years, as the event dispatcher has been decoupled from QCoreApplication for a long time. [*] exception: the callbacks are first called in the thread that invoked QDBusConnection::connectTo{Bus,Peer}, before we've done the moveToThread. Task-number: QTBUG-43585 Change-Id: Ic5d393bfd36e48a193fcffff13b73758c798d6b0 Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge two Q_GLOBAL_STATICS into another and solve memory leakThiago Macieira2015-09-153-26/+30
| | | | | | | | | | | | | | | | | | | | | | | 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-156-95/+142
| | | | | | | | | | 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>
* And move the sending of other types of D-Bus messages to the threadThiago Macieira2015-09-153-12/+15
| | | | | | | | | | With this, we now know that all messages sent are sent from the same thread. This simplifies greatly the handling of the socket. Task-number: QTBUG-43585 Change-Id: Ic5d393bfd36e48a193fcffff13b73758087344ed Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Move the sending of the D-Bus messages with reply to the threadThiago Macieira2015-09-153-8/+18
| | | | | | | | | | | This is intended to simply the handling of the socket in the future. Now, we know that all calls to send_with_reply are placed only from the manager's thread. Task-number: QTBUG-43585 Change-Id: Ic5d393bfd36e48a193fcffff13b737575c231927 Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Remove superfluous code in QDBusConnectionPrivate::sendWithReplyThiago Macieira2015-09-151-6/+0
| | | | | | | | | | | | No need to check for the local loop if that's the first thing QDBusConnectionPrivate::sendWithReplyAsync will do. The side effect is that this now allocates memory for the QDBusPendingCallPrivate object, but loopback messages aren't that common to be worth the special casing. Task-number: QTBUG-43585 Change-Id: Ic5d393bfd36e48a193fcffff13b73756ab802ba2 Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Simplify some code in QDBusConnectionPrivate::sendWithReplyAsyncThiago Macieira2015-09-151-24/+11
| | | | | | | | | | | They're pretty much the same, clearly a copy & paste. Instead, merge the two codepaths so that we don't run the risk of applying a change in one part and forgetting the other. Task-number: QTBUG-43585 Change-Id: Ic5d393bfd36e48a193fcffff13b737560f6753be Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Use a dedicated thread for handling incoming libdbus-1 eventsThiago Macieira2015-09-154-38/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Implement the blocking QtDBus call in terms of the non-blocking oneThiago Macieira2015-09-156-86/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies the code a little by having a single code path. More importantly, we no longer need to call the evil function dbus_connection_send_with_reply_and_block. That function acquires a lock on the socket transport inside libdbus-1, which means all threads need to wait until the one call gets unblocked before they can continue. To do that, this commit reimplements the QDBus::Block part of QDBusConnectionPrivate::sendWithReply by reusing the existing call to sendWithReplyAsync() and then doing a blocking-wait with QDBusPendingCallPrivate::waitForFinished(). By using (Q)DBusPendingCall and the threaded connection approach (next commit), now we never block on the socket. That also means the code to call dbus_pending_call_block() is no longer necessary and the waitForFinished() function itself can be considerably simplified. As a side-effect of no longer blocking, a number of pre-existing race conditions that used to be hidden showed up. Note: this commit deadlocks without the threading (next commits). Task-number: QTBUG-43585 Change-Id: Ic5d393bfd36e48a193fcffff13b73754954a3f7d Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Make QDBusConnectionPrivate::send return boolThiago Macieira2015-09-152-14/+7
| | | | | | | | | It used to return the sent message's serial ID, but we never used that. So simply use boolean instead. Change-Id: Ic5d393bfd36e48a193fcffff13b73753ccf47759 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Albert Astals Cid <aacid@kde.org>
* Use a signal for updating the dispatch statusThiago Macieira2015-09-152-11/+4
| | | | | | | | | | | | | | The cost of connecting a signal may be a bit high, but it's comparable to looking up the invokable method. However, QMetaMethod::invoke has a higher cost than a signal-slot emission -- though in any case they're both dwarfed by the cost of allocating the QMetaCallEvent and the posting of it. This is much more readable, though. Change-Id: Iccecbecbe6288fb3b6d16578fdff3f203b6db29c Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Albert Astals Cid <aacid@kde.org>
* Use QDBusConnectionPrivate* when QDBusServer receives a new connectionThiago Macieira2015-09-155-17/+34
| | | | | | | | | This is because the socket activity will move to a different thread; QDBusConnectionPrivate* can be queued, QDBusConnection can't easily. Change-Id: I82722016018b7fcfb246cda6043469fadbfd987d Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Use QDBusServiceWatcher in QDBusAbstractInterface to track the ownerThiago Macieira2015-09-152-28/+19
| | | | | | | | | | | Instead of connecting to the "NameOwnerChanged" signal. This has better performance, is simpler to implement and is future-proof: when we switch to kdbus, there won't be a "NameOwnerChanged" signal to connect to. On the drawback side, this will use slightly more memory. Change-Id: I5801b8027949f041309567a493000fe7de9bf227 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Albert Astals Cid <aacid@kde.org>
* Fix deadlock if the last reference is dropped during deliveryThiago Macieira2015-09-153-18/+3
| | | | | | | | | | | | | | | | We increase the reference count of the connection during delivery of an incoming message, so it's possible that the corresponding deref will drop the last reference to the connection: another thread may have called disconnectFromBus/Peer. However, during destruction we try to drain the incoming socket queue, so we need to acquire the dispatch lock again. The solution is to always use deleteLater(), which means the deleteYourself() function is unnecessary. Change-Id: I27eaacb532114dd188c4ffff13d507039fcf7b6a Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Remove Q_DECLARE_TYPEINFO that causes a build errorThiago Macieira2015-08-221-1/+0
| | | | | | | | | | ICC doesn't like it qdbusintrospection_p.h(162): error: explicit specialization of class "QTypeInfo<QDBusIntrospection::Argument>" must precede its first use It's used by the QVector in the same class Change-Id: I7de033f80b0e4431b7f1ffff13f958971617b657 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge "Merge remote-tracking branch 'origin/5.5' into dev" into refs/staging/devTimur Pocheptsov2015-08-091-1/+1
|\
| * Merge remote-tracking branch 'origin/5.5' into devFrederik Gladhorn2015-08-061-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: doc/global/qt-cpp-defines.qdocconf src/3rdparty/forkfd/forkfd.c src/corelib/codecs/qtextcodec.cpp src/corelib/kernel/qmetatype.cpp src/corelib/tools/qset.qdoc src/gui/accessible/qaccessible.cpp src/gui/image/qpixmapcache.cpp src/opengl/qgl.cpp src/tools/qdoc/generator.cpp src/widgets/kernel/qwidget.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp Change-Id: I4fbe1fa756a54c6843aa75f4ef70a1069ba7b085