This is the result of running the (experimental) clang-tidy check
qt-modernize-qsharedpointer-create
Discarded changes:
- tst_qsharedpointer.cpp: not sure we want these replacements there
(→ separate change)
- tst_collations.cpp: hit in a template specialization that is
instantiated with both QSharedPointer and QSharedDataPointer.
Change-Id: I203c2646e91d026735d923473af3d151d19e3820
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
There was only one place that needed it.
Change-Id: I067fcfe299b34ab6a771fffd14bf2945f1953d10
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
They're deprecated since C++11 and removed in C++17.
Change-Id: Ia2acd9312707bfee96838743645a04ae1780e5dd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If the respective modules aren't available we cannot build the tests
and examples. We drop the qtConfig(opengl) requirement for the opengl
examples as
a, we would need to make the QtGui configuration available for that to
work, and
b, we should not add too much detail to the tests and examples build
configurations. Checking each test and example for every feature it
uses would be too much.
Task-number: QTBUG-57255
Change-Id: Ifb043c81ec9e5c487765297bd65704812cd281fc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
We should not check for platforms, but rather for features. Also, if
dbus is available it doesn't automatically mean that QProcess is.
Change-Id: I27ef5863fcb107cca1aa47abba95b734962adc33
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
For the windows file system engine, we add an extra macro to use
library loading if configured to do so, but avoid it on WinRT, as
none of the symbols would be found.
We also QT_REQUIRE_CONFIG(library) in the library headers and
exclude the sources from the build if library loading is disabled.
This, in turn, makes it necessary to clean up some header inclusions.
Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.
Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
In tst_QDBusMetaObject::types(), hold a QMetaObject obtained from
QDBusMetaObject::createMetaObject() in a QScopedPointer instead of
leaking it. Use correct return value type.
This fixes the remaining errors in GCC 6.1 Linux ASan runs of
tests/auto/dbus.
Change-Id: I1df7f8e42d45f40ecf381fe7b684a8ab5ebee675
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use the new qtConfig macro in all pro/pri files.
This required adding some feature entries, and adding
{private,public}Feature to every referenced already existing entry.
Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
this migrates the cases where the build system already made (some) use
of variables (possibly) set by configure.
Change-Id: I43a08caed481d5f887a3a40821e71a4797760e7e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QDBusConnection::connect() behaves like QObject::connect with a
connection type of Qt::UniqueConnection | Qt::QueuedConnection. So
return false if it's already connected.
[ChangeLog][QtDBus][QDBusConnection] Fixed a bug that would cause
QDBusConnection::connect() to return true if a slot was already
connected to the same D-Bus signal. QtDBus does not support multiple
connections.
Change-Id: I87e17314d8b24ae983b1fffd1453aef5a7c9ad0b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Move those to the equivalent {to,set,from}SecsSinceEpoch(), except for
the cases that did QDateTime::currentDateTime{,Utc}().toTime_t. Those
are best implemented with QDateTime::currentSecsSinceEpoch().
Change-Id: Ib57b52598e2f452985e9fffd145a366c92cfda20
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Since it's a slot with the same name as an existing one, this test also
verifies that QDBusConnection::connect() can properly distinguish
between overloads.
This test moves the receiver out of the main class, just to be sure that
we don't leave connections behind when tests are run (like
slotsWithLessParameters did).
Change-Id: I87e17314d8b24ae983b1fffd1453ad81952c49aa
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Since f8b5142e30 is in, we can remove
the blacklisting of the test.
Task-number: QTBUG-53786
Change-Id: I2eaa2ec1f1f2e14f73f2f4b6f5732a3b51061075
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
The test sent a message and hoped that the "delete server" would cause
the server object in the QDBusConnectionManager thread be deleted before
it could receive and process the message. That's racy, because on some
CI machines, it did and then sent back an error reply indicating the
object sought was not found.
Instead, let's use a child process that we can kill to make it exit at
the right time.
I've chosen to use dbus-daemon itself, because that lets us test the
actual conditions that triggered the original bug: the daemon getting
killed during a desktop session shutdown on Linux.
Change-Id: I87e17314d8b24ae983b1fffd1454483aea87c921
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
We need to get QtWayland in the CI asap, and that's why we need to
blacklist every test that fails in the CI without really looking what's
the problem behind it. Sorry for that!
Task-number: QTBUG-53786
Change-Id: I64102c35ad879df07a692a112163f318ffb2f658
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
There's exactly one application that needs this functionality (kded/
kiod), but we should test it too.
Change-Id: Icaa7fb2a490246bda156ffff143d210c6f5f207f
Reviewed-by: David Faure <david.faure@kdab.com>
If we're linking to libdbus-1, qdbus_symbols_p.h #includes dbus/dbus.h,
which may be old and not #define the Unix FD macros. tst_QDBusMarshall
had the definition for one of the macros but not the other, so add the
missing second one.
Change-Id: Id69569111e7d4e619e22ffff144c35edcd6f348b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
libdbus will send a local signal if connection gets disconnected. When
this happens, end all pending calls with QDBusError::Disconnected.
Task-number: QTBUG-51649
Change-Id: I5c7d2a468bb5da746d0c0e53e458c1e376f186a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Most libs use QMAKE_LIBS/CFLAGS, but some have other naming
conventions. Unify them into using QMAKE_LIBS/CFLAGS.
Change-Id: I39b188adc1f9a223a83b294c5315c3095a9c68de
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
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>
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>
This reverts commit 618e2cc081. 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>
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>
This often happens in applications. Besides, we are expecting at least a
call to RequestName to happen.
Change-Id: Ifd2454ffba454fd591d0ffff1425a84563267d19
Reviewed-by: David Faure <david.faure@kdab.com>
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>
Move some code (like registrations of meta types) from init() to
initTestCase() in the process.
Change-Id: I57db5156647cfadab554fbed853b2e68b2815f3b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Use character literals where applicable.
Change-Id: I1a026c320079ee5ca6f70be835d5a541deee2dd1
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Use QVERIFY2() with QTemporaryDir/File::errorString() consistently.
Attempt to catch issues like the below warning and follow-up issues.
QSYSTEM: tst_QFiledialog::clearLineEdit() QFileSystemWatcher: FindNextChangeNotification failed for "C:\Users\qt\_____aaaaaaaaaaaaaaaaaaaaaa" (Access is denied.)
Task-number: QTBUG-47370
Change-Id: I58a6e87c502627e976efa62ad73c912f3b2d49fa
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
The explanation is in the code comment. Ever since QDBusConnections
began being processed in a separate thread, we were relying on the fact
that the main thread didn't begin processing its event queue until the
second event got posted (the event loop only exits after it has finished
processing all pending events). We had a race between the main thread
starting its processing, at which point it decides which is the last
event it will process, and the QDBusConnectionManager thread posting the
second event.
This is very fragile code, since it depends on the behavior of
QDBusConnectionPrivate (how it stores the signal relays in a hash) and
that of QHash with duplicate keys. This only works because the hash
key between the two connections is the same (it's only dependent on the
method name and interface name). If we ever begin using something that
isn't the same between "control" and "p", then with QHash's randomness,
we'll be racy again.
Change-Id: I42e7ef1a481840699a8dffff1406c3a4674ec3a6
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
In some cases it's not possible to use QT_HASH_SEED, specially when
we need to set the environment variable from inside the application,
as dynamically loaded libraries or plugins may create static QHash
instances. That would set qt_qhash_seed to a value different from
-1 and skip the env var value.
For those cases, and when we still want to set qt_qhash_seed, we
provide a way to enforce its value.
Auto-tests accessing qt_qhash_seed directly have been updated
accordingly. Usage in qdoc, uic and rcc has been left as is
for the time being.
Change-Id: I3b35b4fa0223c83b1348a6508641905a2a63266f
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
P2P connections don't have senders and receivers, so asking
QDBusConnection to connect to a signal with a sender was a mistake
(added in 5368e44a86). Due to an internal
bug, this never presented itself -- double fault.
Fix the connection so that we don't get unit test failures when the bug
is solved.
Change-Id: I9a75ad8521ae4e5cbbe5ffff13d1a78b7dea6d07
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
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>