Qt uses QHash as the container for faking environment variables on
Windows Runtime and CE. Environment variable manipulation functions are
protected by mutex. Accessing the QT_HASH_SEED environment variable
inside QHash can lead to situation where qputenv() call leads to
qgetenv() call and that leads to a deadlock. Change the container
from QHash to QVector to avoid deadlock.
Task-number: QTBUG-49529
Change-Id: I550ead4ab12e7abebc044f52339063a44fcf0170
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
The latter is much faster as it doesn't have to deal with
time zones.
This change is safe because QNetworkHeadersPrivate::fromHttpDate(),
used as the QDateTime source in other, nearby, code paths, also
returns only UTC date-times. So not only is this change faster at
the call site, it also avoids inconsistent-timespec comparisons
down the line.
Credits to Milian Wolff, from whose QtWS15 talk this advice is
taken.
Change-Id: I26d308a2763cc45d28bc96871e651f30b17a6b85
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
When a datagram is sent to a closed host/port combination, the host will
likely send back an ICMP error message. In the regular socket API, there
isn't a good way of actually receiving this error, so some Windows kernels
wired that message back up to the call to WSARecvFrom() as a synthetic
datagram. Reading this datagram results in a WSAECONNRESET error code,
which should reported to the user as a refused connection attempt.
To make the errors a bit more informative, the native error strings for
WSAECONNRESET and WSAENETRESET were also added.
Task-number: QTBUG-49301
Change-Id: If659be54ba1b39965b5f481f0c0cb9eeea0a06d2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.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>
The system call is not present on earlier releases, and since the 9.x
series will be supported until the end of 2016, add a check for the
__FreeBSD_version macro and only enable pipe2 support if the value is
high enough.
Change-Id: I5633531cec7e95d42ff5f4b14afe772ae8d7d66d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is a follow-up to c8c4ad0 ("forkfd: Define __BSD_VISIBLE and
_NETBSD_SOURCE").
Defining those macros in forkfd.c is not enough: forkfd_qt.cpp also sets
_POSIX_C_SOURCE, and sys/cdefs.h can be included implicitly via Qt's
headers (<algorithm> ends up pulling unistd.h that leads to sys/cdefs.h
and sys/types.h with both libstdc++ and older libc++ versions). In this
case, __BSD_VISIBLE/_NETBSD_SOURCE are not defined, _POSIX_C_SOURCE is,
several type definitions are omitted and by the time we include
sys/time.h in forkfd.c the build fails. On FreeBSD < 11, the error looks
like this:
In file included from io/../../3rdparty/forkfd/forkfd.c:36,
from io/forkfd_qt.cpp:80:
/usr/include/sys/time.h:94: error: 'u_int' has not been declared
Change-Id: I01fa2f5861027d99936d3026faeee9f0db3ecabd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
So we can do
connect(&watcher, SIGNAL(finished()), receiver, SLOT(foo()));
Change-Id: I39cc61d0d59846ab8c23ffff14241d33fecf2d53
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
They're never pending, since we add them immediately since commit
186d881440.
Change-Id: I39cc61d0d59846ab8c23ffff14241be6785ad5a0
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Otherwise, connectInternal becomes a no-op after an initial connection attempt
has been made (making the socket effectively useless if that connection attempt
fails).
A workaround is to close() the socket, which worked by virtue of
QAbstractSocket's close() disconnecting (which ultimately calls
resetSocketLayer, and destroys the socket engine instance) - meaning that the
next connection attempt would have a fresh socks instance to try out the
connection with.
Reported-by: Gabe Edwards <gabe.edwards@me.com>
Change-Id: Iab1e84af6d4248fd75a6dfe5e79a3c73129aae0b
Reviewed-by: Richard J. Moore <rich@kde.org>
Screens connected to separate graphics cards are detected as
separate screens which don't have offset. This patch fixes obtaining
the screen number by QWidget: it uses the screen assigned to the root
widget. The patch also assigns a proper QScreen to each QDesktopWidget
screen().
It also fixes closing a popup menu by clicking on another screen.
Task-number: QTBUG-48545
Change-Id: I3d76261c0c067293d39949c4428b2d8dfd085dc7
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Since 7a42c8c15c QTestTablePrivate no
longer cleans up the memory it holds in dataList. This will make tools
such as valgrind/address-sanitizer generate a lot of noise about
directly or indirectly leaked memory.
Change-Id: Ic0900ecdd7b76cda9f5366f3950bccde2f1b244c
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
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>
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>
Before this patch, Qt5Core_EXECUTABLE_COMPILE_FLAGS was populated with
-fPIC unconditionally. This causes warnings on MSVC, since the compiler
does not understand this flag.
In fact, -fPIC is only required in case an older release of CMake is
being used and the compiler is GCC 5.x (according to documentation), so
let's really add it just in this case.
Task-number: QTBUG-47942
Change-Id: I9d09b8b257a0647235d6d781ee5c023af34f8f88
Reviewed-by: Stephen Kelly <steveire@gmail.com>
CMP0054 changes CMake behavior wrt. interpreting quoted arguments in
if() statements. This change ensures that CMP0054 dev warnings are
never emitted no matter how polluted the environment, e.g. even
if the variable ${5.5.1} is defined and no matter whether CMP0054
is set to OLD, NEW or undefined.
Change-Id: Iee008497b333e2db23fb1adbf8b02252314ffa8a
Reviewed-by: Kevin Funk <kfunk@kde.org>
Reviewed-by: Stephen Kelly <steveire@gmail.com>
pipe2's availability on BSD operating systems depends on the
__BSD_VISIBLE macro on FreeBSD and OpenBSD and _NETBSD_SOURCE on
NetBSD (DragonFly BSD appears to define it unconditionally).
Those two macros are generally set by default, except when
_POSIX_C_SOURCE is set. Since we consciously set _POSIX_C_SOURCE but
need pipe2, explicitly define the visibility macros.
This fixes the -no-pch build on FreeBSD at least.
Change-Id: Icc77f6b5d1f9a5bf7bd8048cabbb01f8f89397cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Fixes the xcb_glx plugin to follow the -opengl configure option for
default surface types. This makes it match closer to xcb_egl behavior
and makes the default match QOpenGLContext::openGLModuleType.
Change-Id: Iea3f8069fffefa46a32945eeeea1312566df129f
Task-number: QTBUG-50015
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
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>
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>
install_sys_qpa() is called for each QSystemTrayIcon::show(),
leading to spurious calls of user slots if the signal isn't
disconnected on remove_sys_qpa().
Task-number: QTBUG-48068
Change-Id: Ic830250c71fee6b584550ab5aabf54289e478fcb
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Richard Rondu <rondu.richard@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
This patch makes possible to use Xinerama screens in XCB platform
plugin.
Task-number: QTBUG-48615
Change-Id: Ib4dbfcdfadc46d2875a2fc09e8b852181edfbed2
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
/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>
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>
Path normalization should happen only when NormalizePathSegments is set.
Use a less intrusive fix for the setPath("//path") issue that
commit aba336c2b4 was about.
This allows fromLocalFile("/tmp/.") to keep the "/." at the end,
which is useful for appending to the path later on (e.g. to get "/tmp/.hidden")
Change-Id: Ibc3d4d3276c1d3aaee1774e21e24d01af38fa880
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If the environment variable is set, but points to a non-existing directory,
the user would get a warning about chmod failing. Better be clear and
warn about the fact that the directory itself doesn't exist.
Also warn if $XDG_RUNTIME_DIR points to a file rather than a directory.
Task-number: QTBUG-48771
Change-Id: If84e72d768528ea4b80260afbbc18709b7b738a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
In Qt3 this would indeed be equivalent to QHostAddress("0.0.0.0").
But since Qt4, it creates an address of type Null, and
QHostAddress()==QHostAddress("0.0.0.0") is no longer true.
Change-Id: I28025421e77c861783c612c2225be345dad5615a
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
This partially reverts commit 025d6a778c.
Change-Id: I7b964b0d598abe46137c22177fe2b5dcca5bb812
Task-number: QTBUG-49831
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Commit ed0c0070 introduced qt_subtract_from_timeout but used it
incorrectly in several places.
Change-Id: I80ea16088707929a45d5a61ec6f3370f8e63d1cd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
It should the the actual class name, without any suffix.
This also allows us to use the painter font when rendering
CE_HeaderLabel and, as a consequence, change QHeaderView's
font through the usual methods.
Change-Id: I0b13ee349f5fa505be66a9c884c26885f5fc468f
Task-number: QTBUG-33855
Task-number: QTBUG-37153
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
while we evaluate the features themselves in precise mode (which is the
reason why they can error out), we do not want them to terminate
cumulative project evaluation.
Change-Id: I70f3e1bcb2ca04a70c74ff484749ca92c1cf6372
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qttools/90ee4094161b427c32581bca2f5286edb4fffdb1)
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
After 90e7cc172a, QStringList no longer
includes QDataStream.
This also reverts commit c1be0fbe7d, which
did the same in a worse way.
Change-Id: Ib10622b0da3b3450d29fc65dc5356fde75444a8f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
(cherry picked from qttools/376501ae5a86859821c0e89b2e8fbc9906d11e07)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Recent versions of Qt have apparently added sufficient numbers of
headers that the command lines used to spawn a custom header-
parsing tool, started overflowing Windows' maximum command-line
length.
This change restructures the mechanism to use a GCC-style command-
line arguments file rather than passing filenames all directly
in the argv[] vector.
Although QNX is the usual ELF target whose cross-build is supported
on Windows, the mechanics introduced in this patch happen to affect
all other ELF Unix systems' builds too.
Change-Id: I5a7383cf9f2ebf9dffde8dbfdcdeca888265e085
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Currently the moc rule does not support dependency scanning, so after
successful moc file generation it will ignore implicit dependencies
in the header file.
Although this works in most typical scenarios, at least in one case
incremental builds become broken: when using Q_PLUGIN_METADATA() with
the FILE argument.
If FILE refers to a JSON file and latter was updated, then the expected
behavior is to regenerate the moc file. Since CMake add_custom_command()
does not support late dependency setup, all dependencies should be
explicitly listed in a DEPENDS section.
This patch adds the DEPENDS multiarg option to qt5_wrap_cpp(),
allowing to specify additional dependencies to the moc rule.
Task-number: QTBUG-44009
Change-Id: I2052ce23d3cb0c87c6bd99fcb7e8a71a7be9a330
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Daniel Levin <dendy.ua@gmail.com>
This is more future-proof. It fixes the detection of 32-bit on ARMv8-A
processors since it uses the __ARM_ARCH macro that GCC and Clang
define. For MSVC, we use _M_ARM, which also contains the architecture
version. MSVC does not currently support ARMv8 code, but when it does,
this commit should make the support automatic.
I don't know which compiler defines __TARGET_ARM_ARCH, but support it
too.
Change-Id: I8de47ed6c7be4847b99bffff141c8ede54a849eb
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
When QT_VISIBILITY_AVAILABLE is defined, the zlib header would use
visibility("default") instead of Q_DECL_EXPORT, but Windows needs
dllexport for these symbols to be available to QtGui/QtNetwork.
In practice, Q_CORE_EXPORT always has the correct behavior for the
zlib symbols.
Change-Id: I7ab8080528e437260f822ac33e9e4334e2a0fdc8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
When the byte sequence for a BOM occurs in the middle of a utf8 stream,
it is a ZWNBSP.
When a ZWNBSP occurs in the middle of a utf8 character sequence, and the
SIMD conversion does some work (meaning: the length is at least 16
characters long), it would not recognize the fact some charactes were
already decoded. So the conversion would then strip the ZWNBSP out,
thinking it's a BOM.
The non-SIMD conversion did not have this problem: the very first
character conversion would already set the headerdone flag.
Change-Id: I39aacf607e2e068107106254021a8042d164f628
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>