Commit Graph

6260 Commits

Author SHA1 Message Date
Maurice Kalinowski
f05c597ae5 winrt: msvc2015: refactor file handling
msvc2015 reintroduced a couple of functions from the win32 API
towards WinRT.

Enable usage of those and simplify the file system engine.
Furthermore update the autotests.

Change-Id: I9eafffba0ddfd05917c184c4a6b9e166f86d71d9
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-21 05:53:17 +00:00
Thiago Macieira
dcc36d7aa3 Autotest: remove the check that broadcast = ip | ~netmask
It's possible to configure an interface so that it isn't the case. I have
no idea if this is a valid scenario, but the unit test shouldn't enforce
that.

ip addr can report:
    inet 192.168.1.1/32 brd 192.168.1.255 scope global vlan0
       valid_lft forever preferred_lft forever

Change-Id: I8de47ed6c7be4847b99bffff141c337575760bd9
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-01-21 05:19:13 +00:00
Jani Heikkinen
7b2fb038ae Merge "Merge remote-tracking branch 'origin/5.5' into 5.6" into refs/staging/5.6 2016-01-21 04:27:06 +00:00
Edward Welbourne
1967accb64 Expand springForward_data() to cover a few more time-zones.
The important one is EET, for the benefit of our CI system; but other
European zones and the USA's coastal zones likely have enough hackers
in them to make this worth checking.

Change-Id: Idcc703bce29808e1a0a6279680cc8d3cbed38dac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:58 +00:00
Edward Welbourne
f7d9e34b96 Be fussier about setting tst_QDateTime's globals.
Time zones change on the whim of politicians.  Consequently, we can
seem to be in CET/CEST or on UTC (because we tested sample dates when
our zone coincided) when we aren't (i.e. we're in a materially
different zone at the time probed by some particular test).  Make the
initialization of the globals that test this more robust against
governmental meddling and document the unfixable problem with Algeria:
a DST transition *on the epoch*.

Change-Id: I17c5c81d339b80af12f4ffab367e28052dd6c2fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:49 +00:00
Edward Welbourne
722df6e0a2 Nomenclature corrections relating to CET.
There are several European time zones; the only one relevant to the
tests here is CET.  They won't work with WET, GMT or EET.  So name
them and related variables for CET, not for Europe.

CET's summer-time isn't called CST; and the (existing) spring forward
test works only in CET/CEST, not elsewhere in Europe.

Change-Id: I55c7544bf792de7495700b749b935ec534831d8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:33 +00:00
Kevin Funk
8dad3bf212 Fix toDisplayString(QUrl::PreferLocalFile) on Win
When using QUrl::PreferLocalFile we do want to strip the leading slash,
as toLocalFile() would do as well.

Behavior change by means of an example:
  QUrl url(QUrl::fromLocalFile("C:/file.txt")
  url.toLocalFile() --> "C:/file.txt"

Before:
  url.toDisplayString(QUrl::PreferLocalFile) --> "/C:/file.txt"

After:
  url.toDisplayString(QUrl::PreferLocalFile) --> "C:/file.txt"

Task-number: QTBUG-41729
Change-Id: I7d425541f6077ebcf3fcf46feeb7e0f03a0d7fe2
Reviewed-by: Dominik Haumann <dhaumann@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 13:24:53 +00:00
Timur Pocheptsov
b530ca770f tst_qtextcocumentlayout::blockVisibility - make the test more robust
The test inserts strings "0" ... "9" into the text document,
takes the half of resulting document's size, makes half of
lines invisible and compares sizes. On OS X 10.11 after inserting
"4" the width changes, so making "4" invisible also reduces the width
and QCOMPARE(currentSize, previosHalfSize) fails. Instead of digits,
insert the same string "A" 10 times.

Change-Id: Ie88a0442703f98949cea9bcdb694cecee59695f3
Task-number: QTBUG-49848
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-01-19 14:48:47 +00:00
Liang Qi
8f569c740a Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	config.tests/common/atomic64/atomic64.cpp
	configure
	src/3rdparty/forkfd/forkfd.c
	src/corelib/io/forkfd_qt.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
	tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
	tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
	tools/configure/configureapp.cpp

Change-Id: Ic6168d82e51a0ef1862c3a63bee6722e8f138414
2016-01-19 10:03:01 +01:00
Stephen Kelly
99e25dd7d8 CMake: Don't attempt gui-tests if Qt is built with -no-gui
Change-Id: I5f327fa1b0c7827535a4b00ca7d0d4281b1eec7b
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-18 13:00:03 +00:00
Alex Trotsenko
294111e25a QHttpSocketEngine: ensure pending EOF triggers a notification
When the remote peer closed the connection, a read notification needs
to always be emitted, otherwise the higher layer does not get the
disconnected signal. From the other side, underlying QAbstractSocket
object could temporarily disable notifications from the engine at
any time. To avoid possible blocking of the socket, take a pending EOF
into account when the read notifications are re-enabled.

Change-Id: Iac9d4e2f790530be3500baf5a2000f1f63df5cc2
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2016-01-18 11:08:34 +00:00
Andy Shaw
8c89a8b1ef [Android]: Java uses some deprecated locale codes so account for these
There are three deprecated language codes that Java still uses for the
locale so we need to account for these inside QLocale by mapping them to
the right language.

Task-number: QTBUG-49632
Change-Id: Ib66b3f2763e085f7384228f2490b048bb56be259
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-13 12:37:56 +00:00
Tor Arne Vestbø
af45b352d7 Fix reentrancy regression in QShortcutMap after c7e5e1d9e
When closing a popup dialog using a shortcut, when the popup
was originally opened using a shortcut, the closing-shortcut
would interfere with the state of the first shortcut, and we
ended up sending a key event for the original shortcut.

Task-number: QTBUG-50360
Change-Id: I62e5ddb9ca43b28519ede629775bc0d7598dccc4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-12 22:08:04 +00:00
Edward Welbourne
81858bf172 Don't pretend we know what DST to use for an offset date.
When QDateTime::addDate() and friends sanitize their end-state, they
were using the DST status of their start-state (if known) to control
it.  This lead to misguided results and, in particular, inconsistent
results given that a raw-constructed QDateTime comes into being
ignorant of its DST, while a .toLocalTime() one knows its DST.

Furthermore, the code to do this was triplicated, tricky and poorly
explained.  So pull it out into a local static function and explain
what it's doing, and why, more clearly and only once.

Task-number: QTBUG-49008
Change-Id: Ia4bb3c5e9267fff8bb963ea705267998218ed623
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-12 09:23:55 +00:00
Marc Mutz
08775e4bd7 Revert "QString: preserve embedded NULs when converting from QByteArray"
This partially reverts commit e486d69133.
It broke too many users, even though all of them deserved to be broken.
The new functionality will be provided by differently-named functions,
where possible (problem: equality operators).

I did not revert the fix for the off-by-one error in
tst_qtextdocumentfragment.cpp.

I also didn't revert the change in the inequality relational operators,
since for all strings s1, s2 and s2' where s2' is s2 truncated at the
first NUL, s1 < s2 ⟺ s1 < s2' (since NUL < c for any c != 0), and,
trivially, for ≤, >, ≥, too. This does not hold for = and ≠, of course,
since "foo\0bar" ≠ "foo".

[ChangeLog][Important Behavior Changes][EDITORIAL] Reverted: All
conversions from QByteArray to QString now preserve embedded NULs...

Change-Id: If4b47048b39ae5be6ed08e6d91809626a67ea7f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-12 06:13:05 +00:00
David Faure
e8479592c5 Doc: mention that Qt::AA_X11InitThreads isn't used anymore
Whether or not to call XInitThreads() doesn't apply since Qt-5.0's switch to XCB.

Change-Id: I5f1e5e664a251c98af6357c87fc9a6bb03a46ce3
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-01-11 17:28:52 +00:00
Kevin Funk
558f69a18b CMake: Ensure that -fPIC is passed in tests.
CMake newer than 2.8.12 automatically adds the
appropriate flag, but CI still runs 2.8.11.

Change-Id: Ie61375f2feb54a92c9d8f0ed6ad5227a67343bc5
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-01-11 09:53:37 +00:00
Friedemann Kleint
f186c4a819 Diaglib: Fix and extend dumping of native windows (Windows).
When recursing over the windows, the code did not take into account
that EnumChildWindow enumerates grand children as well. Exclude
those by checking for the direct parent in the recursion so that
the hierarchy is printed correctly. Add more information about
class and module and rearrange the output a bit so that the window
title is more prominent.

Task-number: QTBUG-50206
Change-Id: Iffb12c44eda9d09da5eb14a8405aee52ed3aa849
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-11 07:56:17 +00:00
Edward Welbourne
89293e6b19 Make DST-transition test more general.
Widen its interval (to work in more TZs) and test spring as well as
autumn.  Anywhere that does have a DST transition probably has it
between August and December; and there's no benefit to using a narrow
window.

There's also no sense skipping the test if we don't know there's a DST
transition: the test should still work, it just won't be testing
anything (about DST transitions).

Combine date and time checks into date-time checks, so that, when one
of them fails, QCOMPARE lets us know how the other changed, too.

Task-number: QTBUG-49008
Change-Id: I145b939ffef0dd0b54fd0e3cdf72a159c57ec00b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-11 07:31:19 +00:00
Thiago Macieira
ac2bde9caf QVariant: make sure two floating points compare equal if they are equal
Not just fuzzily equal. The fuzzy comparison fails for infinities, since
the expression p1 - p2 where p1 = p2 = infinity is NaN. And NaN
comparisons are always false.

As a nice side-effect, we don't do the more expensive computation of a
multiplication if the two numbers really are equal.

Task-number: QTBUG-50036
Change-Id: I11f559ef75544c50b3f8ffff1420cec7c7273295
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-11 05:20:23 +00:00
Thiago Macieira
71c0bb3fd1 Revert "dbus: Add method serial() and replySerial() to class DBusMessage."
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>
2016-01-11 05:19:41 +00:00
Kevin Funk
000c4358ce CMake: Make all tests link to Qt libraries
This is needed as of commit v5.6.0-beta1~483 (Add an automatic use of
the ELF-versioned QtCore symbol, 2015-10-20).  Even if a translation
unit only contains

 #include <QtCore/QString>

 int main(int,char**)
 {
     return 0;
 }

it must link to QtCore which provides the qt_version_tag symbol.

Change-Id: I827c0a7403320e7e5b384d8608face20fcecdaea
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-01-09 15:35:20 +00:00
Marc Mutz
1e2b42523f Fix UB in tst_QObject::disconnectDoesNotLeakFunctor()
If CountedStruct is passed a GetSenderObject object,
it will attempt to call a member on it from within
its own destructor.

That works usually quite well, but in this test case,
which tests for function object leaks when a connection
is torn down because the sender object is destroyed,
the destruction of the CountedStruct happens when all
connections are severed in ~QObject. At that point,
what used to be a GetSenderObject instance no longer
is one and the call into one of its member functions
invokes undefined behavior.

Fix by making QObject::sender() public by a using
declaration instead of a wrapper function.

Found by UBSan:
  tests/auto/corelib/kernel/qobject/tst_qobject.cpp:6007:104: runtime error: member call on address 0x7ffc6e7538b0 which does not point to an object of type 'GetSenderObject'
  0x7ffc6e7538b0: note: object is of type 'QObject'

Change-Id: Ia973140037b3c1b5a670a8a3949d09b956f40349
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-09 15:18:50 +00:00
Thiago Macieira
49c743bdb9 QDate: fix calculation of the week number for the last days of 2020
Off-by-one error: we should have calculated whether the current year is
leap, not the next year. This affected any 53-week leap years.

Task-number: QTBUG-50273
Change-Id: I134ce5db2f82468585ffffff14264cb9f12998fd
Reviewed-by: Martin Klapetek <mklapetek@kde.org>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-09 09:13:44 +00:00
Oswald Buddenhagen
5783a915c4 don't rely on transitive dependencies
Change-Id: Ide872b452e02ebefb3eeb51464c8d59e8bf58bc4
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-08 18:51:02 +00:00
Simon Hausmann
c7797184f0 Prospective fix for running cmake tests with -no-widgets
Don't try to run test_interface when Qt is configured without QtWidgets.

Change-Id: If6c376c250215c1d639b06881d16c0141091f288
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-01-07 19:29:36 +00:00
Marc Mutz
c38b14e251 Fix UB in tst_QSharedPointer::basics()
Binding a reference to the nullptr is undefined
behavior.

Just skip that particular test when 'ptr' is null.

Found by UBSan:
  tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp:258:32: runtime error: reference binding to null pointer of type 'struct Data'

Change-Id: I125588b9d269a6f76716d660d03142f409513885
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-07 13:00:40 +00:00
Marc Mutz
9c7be0a7ec Fix UB in tst_QDialog::showExtension()
Don't cast a QDialog to a subclass it is not.

Fix by creating it as the required subclass in the
first place.

Found by UBSan:
  tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp:203:20: runtime error: downcast of address 0x2b5f5000ad40 which does not point to an object of type 'DummyDialog'
  tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp:203:46: runtime error: member call on address 0x2b5f5000ad40 which does not point to an object of type 'DummyDialog'

Change-Id: I63ae7e782bda6a78d11af5c2bc2f7d88aacd0ac0
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-07 13:00:32 +00:00
Marc Mutz
f5291bf8b4 Fix UB in tst_QObject::noDeclarativeParentChangedOnDestruction()
If QObjectPrivate::declarativeData is set, it is
in various places in Qt expected to point to a
QAbstractDeclarativeDataImpl, from which ownedByQml1
is unconditionally read.

In noDeclarativeParentChangedOnDestruction(), the
declarativeData pointer is, however, set to a local
QAbstractDeclarativeData instance, which, being an
empty class, has size 1 and alignment 1.

Depending on the compiler's idea of bit field order,
this code either read uninitialized data from the
dummy object, or else some random stack memory outside
any (valid) object.

What caught UBSan's attention, though, was the
difference in alignment between the two classes:

  src/corelib/kernel/qobject.cpp:917:9: runtime error: member access within misaligned address 0x7fffc9cf706f for type 'struct QAbstractDeclarativeDataImpl', which requires 4 byte alignment

Fix by providing a properly initialized object of the
correct type.

Change-Id: Iae83a949ee5a7bc98df13e35ea614c063085fa13
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-07 13:00:28 +00:00
Ralf Habacker
618e2cc081 dbus: Add method serial() and replySerial() to class DBusMessage.
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>
2016-01-07 07:42:35 +00:00
Marc Mutz
bccbb70de5 Fix UB in tst_QMetaType
Don't pass around meta-type IDs in QMetaType::Type
variables. It leads to reading values from an enum
variable that are invalid.

Fix by passing the IDs around as int.

Found by UBSan:
  tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:408:5: runtime error: load of value 4028, which is not a valid value for type 'Type'

Change-Id: Idd106ee3d7960fe3d8fefc0fc5830fc22d38a513
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-06 22:07:09 +00:00
Marc Mutz
033205bb59 Fix UB in tst_QIODevice::getSetCheck()
The reinterpret cast from a QTcpSocket → QAbstractSocket → QIODevice
to MyIODevice → QIODevice was undefined.

Fix by simply instantiating a MyIODevice, which must then inherit
from QTcpSocket, of course.

Instead of fixing the class name in the overridden setOpenMode()
method, simply make the base class' implementation public with
a using declaration.

Found by UBSan:
  qtbase/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp:84:22: runtime error: member call on address 0x7ffcca2d23f0 which does not point to an object of type 'MyIODevice'
  0x7ffcca2d23f0: note: object is of type 'QTcpSocket'

Change-Id: I939b3548949b9b5765df4a6cc81875e169fd69dd
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-06 17:25:05 +00:00
Friedemann Kleint
a62132b22c Diaglib: Output more information about QWindow.
Output surface class/type, screen name and scaling factors.

Task-number: QTBUG-50206
Change-Id: I88d3494962b29985cd9e492c1761361b73e0172e
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-06 13:04:59 +00:00
Timur Pocheptsov
daeed4631a Blacklist failing tst_QFile tests (OS X)
openStandardStreamsFileDescriptors and openStandardStreamsBufferedStreams
fail on OS X: lseek somehow works on sequential streams (standard streams)
but QFile has pos() == 0 (since it's sequential).

Change-Id: I6a6161c012a91de189f59c533880fb8fe7a66d37
Task-number: QTBUG-49841
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
2016-01-06 09:38:55 +00:00
Alex Trotsenko
02f70004c2 Allow socket events processing with a foreign event loop on Windows
While a native dialog is open, the application message queue is
handled by the native event loop which is external to Qt. In this
case, QEventDispatcherWin32::processEvents() does not run and socket
notifiers will not be activated. So, this patch moves the notifier
activation code into the window procedure, which enables socket
event processing with native dialogs.

Task-number: QTBUG-49782
Task-number: QTBUG-48901
Change-Id: Icbdd96b2e80c50b73505f4fe74957575b83d6cf1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-01-05 13:05:35 +00:00
Masaru Ueki
e0a5f661e5 QStateMachine: fix ignore high-priority events.
When a high-priority event is posted in overrided
'QStateMachine::beginSelectTransitions', the event may be remained in
event queue, and be not dispatched until another event posted.

Change-Id: Ifda288d9c00ac7985e426b9cc02bda382ebaac35
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2016-01-05 10:05:40 +00:00
Friedemann Kleint
38c8af7231 Revert "Fix global coordinate mapping for child widgets in QGraphicsView."
This reverts commit 56aad2ad60.

QWidget::mapFromGlobal() does not work correctly when the widget is
a child widget of another widget embedded into a QGraphicsView with a
transformation (scaling/rotation). It starts applying offsets going
up the widget tree (just as mapToGlobal) until it hits the embedded widget
not taking into account the transformation.

It would need to go in from to top to bottom or better be reimplemented
such that a QTransform for mapping coordinates from/to global is determined
which is then applied in reverse.

Task-number: QTBUG-50030
Task-number: QTBUG-50136
Change-Id: Iadeb891d793be1938c64942bfbf38d541a281c33
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-05 08:18:18 +00:00
Oliver Wolff
190c76f685 winrt: Use winsock2 API for hostname resolution on WinRT/WinPhone
That API has been available for WinRT and Windows
Phone for some time now. By using it to get the
machine name and for hostname resolution we can get
rid of some winrt-only code and use qhostinfo_win.cpp
on WinRT and Windows phone as well.

Additionally the required capability was added to
tst_qhostinfo so that this auto test can be run without
any manual editing.

Change-Id: I63fa5521bf8cdb0c919bd5a0100ea977c865622a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2016-01-05 08:14:31 +00:00
Timur Pocheptsov
4ed8733d90 tst_Gesture - fix failing tests on OS X 10.11
This test seems to be quite broken on OS X: qWaitForWindowExposed returns
too early (while no window is on screen) so gestures can not be dispatched
QApplication::topLevelAt(pt) - returns null.
Use qWait + isExposed combo instead (similar to qWaitForWindowExposed, but
there is no isExposed test before the loop).

Change-Id: I85fbd773ccce0ca92b2dceb1749d67ef767aa0cf
Task-number: QTBUG-49849
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-01-05 06:08:18 +00:00
Edward Welbourne
374d35d5ba Make use of preprocessor easier to understand.
The #if had a condition that was needlessly hard to understand;
and was widely separated from its #else clause.

Change-Id: I43f4282993f4f2e8c4b5ad07dc2c2e06a6b95aa9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-04 13:59:14 +00:00
Thiago Macieira
b08d84d39e Autotest: Make sure that we can place calls with disabled delivery
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>
2016-01-03 19:16:33 +00:00
Thiago Macieira
0828d4e8ea Autotest: test both libdbus-1 load failure and connection failure
Change-Id: I39cc61d0d59846ab8c23ffff14242294649c1a45
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:06:10 +00:00
Thiago Macieira
9510d99f08 Autotest: Mark D-Bus tests that don't connect to the bus as parallel
There's no problem running them in parallel.

Change-Id: I39cc61d0d59846ab8c23ffff142420a127ab6968
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:05:52 +00:00
Thiago Macieira
1f6fa1f37a Suspend processing of some messages in the default busses by default
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>
2016-01-02 02:05:45 +00:00
David Faure
72b4f0d474 QMimeDatabase: follow symlinks when checking for FIFO etc.
This was documented, but not what the code did.

Task-number: QTBUG-48529
Change-Id: I4849778c61dcae13be27c62b24717693c0c07d78
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-29 11:06:13 +00:00
Alex Trotsenko
6b6955c2ff QAbstractSocket: do not enable read notifications on TCP in bind()
In bind+connect scenario, rejected connection can trigger a read
notification while the socket is opened. But unlike UDP, reading from
the socket engine or emitting a readyRead() signal is not allowed for
the TCP socket in bound or connecting state.

To make a bind+connect scenario work properly, disable the read
notifications until a connection is established.

Task-number: QTBUG-50124
Change-Id: I7b3d015b0f6021fb9ff9f83560478aa5545f41f5
Reviewed-by: Richard J. Moore <rich@kde.org>
2015-12-24 14:05:26 +00:00
Alex Trotsenko
27479c1323 Enable a test for QFilePrivate::fileName offset on 32 bit Linux
Change-Id: I3577ff7126263ddbe4b7714095480e6f1da7b661
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-12-23 14:36:15 +00:00
Marc Mutz
a2d218cc41 tst_collections: "explicit instantiation of 'NS::QList' must occur in namespace 'NS'"
Probably correct.

The question is just why this code has survived for so many years.

Change-Id: Iaf01850476f9b066243abebb9ee6c5928d7ada19
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-23 08:35:49 +00:00
Friedemann Kleint
f7a167223b tst_QTemporaryDir::nonWritableCurrentDir: Add a check for write protection.
/home has been observed to be writable on some CI machines.
Add checks verifying existence and correct permissions.

Change-Id: Ie0f952e20d0d8eb0b57234eea2e2ecb78f5a7b58
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-12-22 10:59:03 +00:00
Lars Knoll
26237f0a2d Fix QJsonValue::fromVariant() if the variant contains a json object
If the variant contains a known json type (value, array, object or
document), simply unwrap those. In the case of the json document
wrap the contained object/array into a QJsonValue.

This should be the expected behavior, and makes more sense than
returning a null QJsonValue.

Task-number: QTBUG-41234
Change-Id: Id084fc11220d51aaf78b7694fd0ebef1411f5c51
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-22 10:00:46 +00:00