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>
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>
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>
Tests are now passing in CI.
Change-Id: I0051fb7070c1c1027c557eba9dde6367ad59ac7a
Task-number: QTQAINFRA-837
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The QDBusMessage::createSignal() static method doesn't take a parameter
for specifying the destination service of the signal. While this is not
a widely used feature, it can be useful to avoid waking up all connected
clients when the service knows what are the clients which are interested
in the signal.
This commit adds a QDBusMessage::createTargetedSignal() method which
also takes the destination service as its first parameter.
Change-Id: I9fdca53673a6944c39c93c1efd69a9d02859684e
Task-number: QTBUG-44704
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Currently QDBus relies on a key in QMetaClassInfo to understand the DBus interface name.
This patch allows QDBus to also use a specified interface name in the registerObject call
instead of relying on QMetaClassInfo that might not be there (if the QObject was created
in QML or Javascript for example).
Change-Id: Ie02b2c67e7deb07f43e35eb166c11833fcbf38f3
Task-number: QTBUG-44074
Reviewed-by: Kevron Rees <kevron.m.rees@intel.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
Two serious mistakes:
- we need to call dbus_server_free_data_slot as many times as we call
dbus_server_allocate_data_slot
- we need to delete the d pointer...
The changes to the unit tests are simply to cause the used peer
connections to be removed so they don't show up in valgrind.
Change-Id: I9fd1ada5503db9ba481806c09116874ee81f450d
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
The error of "Not connected".
This incidentally solves a crash when QDBusServer().lastError() is
called but libdbus-1 couldn't be found.
Change-Id: Id93f447d00c0aa6660d4528c4bbce5998d9186a8
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
This allows the tests to be run on Windows too by using TCP socket
connections instead of requiring Unix sockets. The tests shouldn't have
hardcoded the path, which came from QDBusServer anyway. Now the tests
simply defer to QDBusServer.
This is a slight behavior change for Windows, but not one that should
matter since anyone who was using the default constructor resulted in a
QDBusServer that failed to listen.
[ChangeLog][QtDBus][QDBusServer] Fixed a bug that made QDBusServer's
default constructor try to bind to a Unix socket on non-Unix systems.
Now QDBusServer will attempt to bind to a TCP socket instead.
Change-Id: I2a126019671c2d90257e739ed3aff7938d1fe946
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
D-Bus libraries were recently added to OS X 10.7 making these
tests to be executed for first time.
Task-number: QTBUG-37469
Change-Id: Ia7a74a45b18d4a645307f7fb7666236c5e009e5f
Reviewed-by: Simo Fält <simo.falt@digia.com>
The new member variable activeChildren shall contain the number of
direct children that are active. This number differs from
children.count() because the vector may contain empty entries that
haven't been garbage-collected yet (obj == NULL and activeChildren ==
0).
When this count drops to zero, we know we can simply erase the vector of
children.
Change-Id: Ia20604d3fac852ea4a6e8862d934fbb936fa5e18
Reviewed-by: David Faure (KDE) <faure@kde.org>
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>
Create a new QDBusConnectionPrivate for every new connection in
qDBusNewConnection instead of creating a single QDBusConnectionPrivate
in the QDBusServer constructor which gets assigned the latest connected
DBusConnection in qDBusNewConnection (and loses track on all previous
DBusConnections).
Also extend tst_QDBusConnection::registerObjectPeer() test with multiple
connections to the server.
Task-Number: 24921
Change-Id: I4341e8d48d464f3fe0a314a6ab14f848545d65a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Qt 5.0 beta requires changing the default to the 5.0 API, disabling
the deprecated code. However, tests should test (and often do) the
compatibility API too, so turn it back on.
Task-number: QTBUG-25053
Change-Id: I8129c3ef3cb58541c95a32d083850d9e7f768927
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Lots of uses of the annotations and error names, plus a bunch of local
unit test names (including one file that had to be renamed).
The meta object generator is updated to support both the old and new
names. That means some references to com.trolltech *must* remain in the
source code.
Task-number: QTBUG-23274
Change-Id: Icc38ae040232f07c437e7546ee744a4703f41726
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
QCOMPARE should only be used in a test function because it makes the
test function return if the compare fails. The test wants to compare
without returning on failure because the compare is inside a helper
function called by many test functions, so the test was calling
testlib's internal QTest::compare_helper() functions instead of
QCOMPARE.
This commit makes this code slightly less objectionable by calling the
public QTest::qCompare() instead.
Change-Id: Ida17a641e89f8a297d6a036449f44b33aa266368
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
qttest_p4.prf was added as a convenience for Qt's own autotests in Qt4.
It enables various crufty undocumented magic, of dubious value.
Stop using it, and explicitly enable the things from it which we want.
Change-Id: I02fe27b2c1800f929250fa8694ca2976c9661a12
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
There was logic in .pro files for the dbus tests to omit the body of
each test if dbus was not available in the Qt build. This was all
redundant however, because tests/auto/auto.pro already excluded all dbus
tests if dbus was not available in the Qt build.
Change-Id: Iaea06e38622e5227daec4d2e08106c2da3fb4013
Reviewed-on: http://codereview.qt-project.org/6372
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>