There was a race condition between QObject::disconnect() and
QMetaObject::activate() which can occur if there are multiple
BlockingQueued connections to one signal from different threads and
they connect/disconnect their connections often.
What can happen in this case is:
T1 is in activate() method and T2 is in disconnect() method
T1 T2
locks sender mutex
selects next connection
unlocks sender mutex
locks sender mutex
sets isSlotObject to false
creates QMetaCallEvent derefs connection
posts event
Two things can happen here:
1. Connection can still be valid, but it will have isSlotObject==false
and callFunction will be used instead of slotObj
2. Connection can already be invalid
To fix it mutex unlock should be moved after QMetaCallEvent creation.
Also there is another case, when we don't disconnect but delete the
receiver object. In this case it can already be invalid during
postEvent, so we need to move mutex unlock after postEvent.
Change-Id: I8103798324140ee11de5b4e10906562ba878ff8b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Same reasoning as commit 3092bd5 (which was for Clang), but for gcc >= 5.1.
Change-Id: I123b17670c1a64876b01fd39fb11648fa4e8b1fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
It crashed when d was equal to Data::unsharableEmpty().
Task-number: QTBUG-51758
Change-Id: If9f2a7d11892507135f4dc0aeef909f59b7478fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Much like the QObject::setParent() warning, which helps a bit when debugging.
Change-Id: I2abf277a12aa1ce04bd8b5759f46f8bfdcb25383
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Conflicts:
src/corelib/io/qtemporarydir.cpp
One side encapsulated a repeated piece of #if-ery in a local define;
the other added to the #if-ery. Made its addition to the other's.
src/corelib/kernel/qeventdispatcher_unix_p.h
One side moved some members into a struct; this collided with a #undef
check that neither side now has. Discarded the #undef part.
src/gui/opengl/qopengltexturehelper_p.h
5.7 deleted a bunch of methods; not clear why merge got confused.
src/tools/moc/moc.cpp
One added a name to the copyright header; another changed its URL.
Change-Id: I9e9032b819f030d67f1915445acf2793e98713fa
[ChangeLog][QtCore][Important behavior changes] qFatal will now
use std::abort to terminate the application on all operating
systems. Previously, ::abort() or ::exit(1) were called, depending
on the operating system.
Change-Id: I43da912cce1db3c2229568da25000ea80060eed9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Now QBasicMutex is Lockable and QMutex is TimedLockable, which means they can
be used in std::lock_guard, std::unique_lock, std::lock, etc.
[ChangeLog][QtCore][QMutex] QMutex now fully models the TimedLockable
concept by providing the try_lock, try_lock_for and try_lock_until
functions, therefore making it usable in Standard Library lock
management classes and functions.
Change-Id: I7c691481a5781a696701e1ab78186b5cefbd6a87
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Known ICC bug, still present in version 17 beta.
qdatetime.h(126): error #3280: declaration hides member "QDate::jd" (declared at line 136)
Obviously a parameter to static function or to a function in a nested
class can't shadow an NSDM.
Intel issue IDs: 0000698329 / DPD200245740
Change-Id: I149e0540c00745fe8119fffd1463c679a3a9c8c3
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
As a special case, setting the value of chunk size to zero forces
QRingBuffer to produce a separate QByteArray on each call which
appends the data. So, this enables a packet mode where portions of
data are stored independently from each other.
Change-Id: I2d0b331211901a289da7d4533e974f06830b5590
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
it positively makes no sense to have a configure test which will be
never reached due to the configure/qmake bootstrap failing with a
slew of totally unhelpful error messages.
pre-standardization partial c++11 implementations are now rejected,
except for VS2013, which is still sufficient despite not announcing full
compatibility.
Change-Id: I58af10e03960af06b80cedac105cf8433f7a1745
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Whenever someone installs Clang or the Intel compiler on Windows, it's
very likely that the compiler will be much newer than the MS headers
that came with the installed Visual Studio version. So let's make sure
we disable the C++11 features that the MS headers don't support
properly.
For example, MS's <limits> header supplied with VS 2013 doesn't mark the
max() function as constexpr, resulting compiler errors in uses of that
function in Qt code declared with Q_DECL_CONSTEXPR:
qdeadlinetimer.h(62,13) : note: non-constexpr function 'max' cannot be used in a constant expression
: s(std::numeric_limits<qint64>::max()), ns(0), type(type_) {}
^
Change-Id: I149e0540c00745fe8119fffd146286ffe480d216
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The number of bytes to write was converted to a 32bit unsigned value,
causing losses. Change the type to qint64 and adapt the code determining
the block size.
Task-number: QTBUG-54870
Change-Id: I294da5bfe97c7e60f67228399e1244a1aba4c89c
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Since Android 5.0 Google introduce a nasty bug[1] which calls
JNI_OnLoad more than once.
Basically every time when a library is loaded JNI_OnLoad is
called if found, but it calls *again* JNI_OnLoad of its .so
dependencies! So, JNI_OnLoad of libQt5Core.so gets called may times,
this is not a problem as long as it's called from Qt's java delegate
class loader. The problem is that the application .so file *must* be
called from default class loader to allow the user to find his custom
Activity/Service stuff.
[1] Workaround https://code.google.com/p/android/issues/detail?id=215069
Change-Id: Ia71209658ef56056b560018597608acf7cb0f9ea
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Instead of reporting the file times in the precision of seconds, our API allows
us to report it up to millisecond precision.
Change-Id: I8bcc6a1fb4116e8c5421d650a68f6fb00482e551
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For platforms not providing mkdtemp(), QTemporaryDir relied on an implementation
of q_mkdtemp() operating on char *, converting back and forth using
QFile::encodeName()/decodeName() when passing the name to QFileSystemEngine.
This caused failures on Windows (which uses "System"/Latin1 encoding)
for names containing characters outside the Latin1 space.
Reimplement q_mkdtemp() to operate on QString, which avoids the conversions
altogether and also enables the use of larger character spaces for the
pattern.
Add tests.
Task-number: QTBUG-54810
Change-Id: Ie4323ad73b5beb8a1b8ab81425f73d03c626d58a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Should be reverted when https://github.com/android-ndk/ndk/issues/34 is fixed
Change-Id: Ic7fe394412afc25082a9689da59d36cba8b3dade
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
If an error occurs during the transaction, we should prevent the
containers from being successfully read. So, check the status of the
stream before reading the container, because the deserialization
procedure temporarily resets it on entry.
Task-number: QTBUG-54022
Change-Id: Ie955c2fa3e449374f0f8403f00e487efa2bfdaf3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The header says they'll stop doing that in the next release. It's been
like that since at least the OS X 10.8 SDK...
Change-Id: Ib57b52598e2f452985e9fffd14585d4838dc8b09
Reviewed-by: Richard J. Moore <rich@kde.org>
C preprocessors augment their standard list of include paths from the
environment: Unix preprocessors use $C_INCLUDE_PATH (for C) and
$CPLUS_INCLUDE_PATH (for C++), plus CPATH for both, whereas MSVC uses
the an environment variable simply called "INCLUDE". Handling this for
MSVC is particularly important because the VCVARSALL.BAT script sets the
necessary #include paths in the environment for important things.
Without that being parsed, moc won't find some #defines, like
WINAPI_DESKTOP_FAMILY.
[ChangeLog][moc] qmake and moc now cooperate to use the Visual Studio
environment variables (set by the VCVARSALL.BAT script) to find system
include files. A possible consequence is that moc parses application
headers slightly differently, depending on #if conditions that depended
on macros that previous versions had not seen #define'd. Implementers of
other buildsystems are advised to pass the --compiler-flavor=msvc option
to moc.
Change-Id: I7e06274214d1939b0124e5b4bf169cceaef9ca46
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We were printing 'loaded library "xxx"' even when ret == false, which
was misleading. So instead print the error string.
Change-Id: Ib57b52598e2f452985e9fffd1459ea860ed2dfcf
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
There is now a DARWIN version for all four Apple platforms at once,
a MACOS_IOS version for macOS and iOS (since many of the checks we need
are prior to tvOS or watchOS's existence), and MAC and OSX have been
relegated to synonyms for MACOS_IOS and MACOS, respectively.
Change-Id: I54f587e26c6b46bf4b469c5d3039086c65566651
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Conflicts:
qmake/library/qmakebuiltins.cpp
qmake/library/qmakeevaluator.cpp
qmake/library/qmakeevaluator.h
qmake/project.h
QMakeEvaluator:
* evaluateConditional(): one side changed return type, the other
changed a parameter type.
* split_value_list(): one side changed a parameter adjacent to where ...
* expandVariableReferences(): ... the other killed one overload and
changed the survivor
src/corelib/io/qlockfile_unix.cpp
One side changed a #if condition, the other moved NETBSD's part of
what it controlled.
src/corelib/tools/qdatetime.cpp
One side fixed a reachable Q_UNREACHABLE in toMSecsSinceEpoch(), the
other moved it from the private class to the public one, in the midst
of the "short date-time" optimization, which confused diff entirely.
One side changed a QStringLiteral to QLatin1String, the other rewrote
adjoining code.
src/network/kernel/qauthenticator.cpp
Both rewrote a line, equivalently; kept the dev version.
src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
One side changed #if-ery that the other removed.
tools/configure/configureapp.cpp
One side added a check to -target parsing; the other killed -target.
tests/auto/testlib/selftests/expected_cmptest.lightxml
tests/auto/testlib/selftests/expected_cmptest.teamcity
tests/auto/testlib/selftests/expected_cmptest.txt
tests/auto/testlib/selftests/expected_cmptest.xml
tests/auto/testlib/selftests/expected_cmptest.xunitxml
Regenerated using generate_expected_output.py
I note that quite a few other expected_* come out changed, now.
There was no git-conflict in
src/widgets/kernel/qformlayout.cpp
but it didn't compile; one side removed some unused methods; the other
found uses for one of them. Put FixedColumnMatrix<>::removeRow(int)
back for its new user.
Change-Id: I8cc2a71add48c0a848e13cfc47b5a7754e8ca584
Align ourselves to what std::thread does (and what's sensible to do anyhow,
since we even document that "Deleting a running QThread [...] will probably
result in a program crash").
[ChangeLog][QtCore][QThread] Destroying a QThread which is still running will
now result in immediate and abnormal program termination.
Change-Id: Ib481287915be01a1381df14abf6e0fb68c36b5b5
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Most fields were over-written after setting invalid. The two that
weren't (not used by QUtcTimeZonePrivate) should be (if only for
uniformity with other QTimeZonePrivate variants), so set them to
sensible values.
Change-Id: I824ca0108d5b6bc322f76a0d1683342f789523b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We can expect C++11 now, and using an initializer list
is much shorter.
Change-Id: I6424d24ce7660b342a629e836b94d62c8868a44d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
The XML parser uses fastScanLiteralContent() to read a block of
text. The routine was not checking the range of valid characters as
defined in the XML standard:
https://www.w3.org/TR/2008/REC-xml-20081126/#NT-Char
A check has been added to stop reading the bad character.
Note that the characters are legal in XML 1.1, but QXmlStreamReader
is a well-formed XML 1.0 parser
[ChangeLog][QtCore][QXmlStreamReader]
Fixed a bug in the XML parser that prevented to load XML that
contained invalid characters for XML 1.0.
Change-Id: I10aaf84fbf95ccdaf9f6d683ea7c31925efff36d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Conflicts:
qmake/library/qmakeevaluator.cpp
One side changed the iterator to use ranged-for, the other changed its
body; they only conflicted because the latter had to add braces around
the body, intruding on the for-line. Trivial resolution.
Change-Id: Ib487bc3bd6e3c5225db15f94b9a8f6caaa33456b
Use QStringBuilder more.
Use QL1S directly, without QString construction.
Change-Id: Iad844391367681fc1013b9725403d009e7c346e6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
When one tries to lock without a timeout, there is no need to allocate
a QReadWriteLockPrivate as we will not wait on it.
Change-Id: I37c96a7fbc0c66fbdffe372f6089708cb2466fe3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The new modular configuration system requires one global
header per module, that is included by all other files in
this module.
That header will later on #include the configuration file
for Qt Widgets. For now it defines the Q_WIDGETS_EXPORT
macro for this library.
Change-Id: I6698989b952b9bac94d086d9f219e03c000f7d53
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The file lives in Qt Gui, but declares a few methods from
Qt Core and Widgets. All of those methods are actually mostly
unused, not documented and pretty trivial.
This patch removes the last few places the methods got used and
removes the declarations. The implementations should get removed
in a future release.
Change-Id: I2b609c29f403d2ed4824ff4346008be08b3fd067
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The two versions of this function are now documented on the
global variables page.
Change-Id: Iee95e251d616f6c8b1b42458d23cbf64a70a5315
Task-number: QTBUG-50654
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We cannot really remove the function, since it's called from
inline code (QCharRef::op=(QChar)), but we can schedule it for
removal in Qt 6, and inline it into existing in-tree callers.
Change-Id: I3499f101dcb5ae908726b3673bf3526a04408db6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The hash function is carefully designed to give the same result
as the straight-forward implementation of qHash(unordered_map),
which we'll probably add at some point, namely: std::accumulate
over a container of std::pair.
This is one reason to use std:: and not QPair in the implemen-
tation of qHash(QHash). The other is that qHash(QPair) uses a
bad hash combiner, which may xor out the 'seed' from the result.
We can't fix that until Qt 6, but the qHash(std::pair) overload
uses the well-known boost::hash_combine algorithm (implemented
in Qt as QtPrivate::QHashCombine), so we can use that.
I also trust std::pair to work without problems with reference
template arguments, while QPair only very recently gained a very
basic auto-test for reference parameters.
[ChangeLog][QtCore] Added qHash() overloads for QHash, QMultiHash.
Change-Id: I90879d8a99cf1aadb6e84ecc0c3704f52f3691da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When I introduced this code in Qt 5.0, I made INT and POINTER be
SOMETIMES_NATIVE, but then later I made the specific sizes be
ALWAYS_NATIVE. That doesn't make sense.
Instead, use the macros from the C++11 <atomic> header.
Note that the member isXxxxNative() functions should not have been
constexpr. That's a defect I introduced in Qt 5.0.
Task-number: QTBUG-51315
Change-Id: I0c94a5c2846b48c8aea7ffff1436013e8686c153
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
These make the (future) usage in declarative even more convenient.
Change-Id: I12c0fec1ea843d8acd2ee3fdf2a2189939bebd95
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
It absence is just an oversight. The patch also adds test for the valid
inputs of the method.
[ChangeLog][QtCore][QJsonDocument] fromVariant can now take a QVariantHash argument.
Task-number: QTBUG-39751
Change-Id: I7e051413f930023db3cbb81452e77c56a7ceffe8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The previous patch works for FreeBSD 10 but however not for 9 and 11
due to the order of includes. Move <sys/user.h> down to fix those compile
issues due to unknown types when user.h is included first.
Change-Id: Ica3d3ddf335a543c4a473e8b80d1667cb81667cf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When the insertion position is not beyond end(), call
resize() instead of expand(), which fills the new size
with spaces, which, however would just be overwritten
by the following memmove().
Add some Q_UNLIKELY to indicate that we strongly
expect the resize() case to be the more common.
Change-Id: Iaf3215dd53c2cbd18f2fd8a5f80af8f6844944da
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In all other forms of disconnecting this is done. We also know the
signal index, so there is no reason not to do this.
Change-Id: Ic8b042cd8f45dbff74b42ee30c384a84bef78b20
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
When replacing each copy of one text with a copy of another, we do so
in batches of 1024; if we get more than one batch, we need to keep a
copy of the sought text and replacement if they're part of the string
we're modifying, for use in later batches.
Also do the replacements in full batches of 1024, not 1023 (which left
the last entry in an array unused); marked some related tests as
(un)likely; and move some repeated code out into a pair of little
local functions to save duplcation.
Those new functions can also serve replace_helper(); and it can shed a
const_cast and some conditioning of free() by using them the same way
replace() now does. (There was also one place it still used the raw
after, rather than the replacement copy; which could have produced
errors if memcpy were to exercise its right to assume no overlap in
arrays. This error is what prompted me to notice all of the above.)
Added tests. The last error proved untestable as my memcpy is in fact
as fussy as memmove. The first two tests added were attempts to get a
failure out of it. The third did get a failure, but also tripped over
the problem in replace() itself. Added to an existing test function
and renamed it to generally cover extra tests for replace.
Change-Id: I9ba6928c84ece266dbbe52b91e333ea54ab6d95e
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Also skip doing a += 0 when we had to test whether the relevant rhs
was zero anyway (because we want to ++ there instead of +=ing).
Change-Id: Ibd5f21eb9aaf410b09c9db8450b2d61618e628fc
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
The default ctor never initializes m_nstz but calls init with
[NSTimeZone systemTimeZone].name. Init (re)sets m_nstz _only_
if this ianaId is in [NSTimeZone knownTimeZoneName], which is not guaranteed
(a good example is "US/Pacific" that can be returned by systemTimeZoneId() -
the similar problem is described in [*]. Set m_nstz to nil in ctor,
so if 'init' fails we still have a valid (nil) pointer.
[*] http://stackoverflow.com/questions/19819268/convert-ios-localtimezone-to-a-knowntimezone.
Task-number: QTBUG-54330
Change-Id: I68917926350aad3158d44a06f06721f25b3fdb74
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The const qualification prevented toUpper() etc from
calling the rvalue overloads of the corresponding QString
functions. Since resolved() always returns a non-shared
object, the rvalue overloads can re-use the object's
capacity for storing their result, saving up to one memory
allocation per QStringBuilderCommon::to*() invocation.
Change-Id: Ica97fcd906cdd949ffe56055654578b93407e2d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use QStringBuilder and QString::asprintf more.
Use += operator to reserve extra capacity for
possible free following append/prepend/+= call.
Change-Id: Ia534bec28cb96b688a68a5051a855cda1eb5db4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Commit fb498a6519 introduced the short
datetime optimization, but it accidentally removed the optimization from
Qt 5.7 that made QDateTime's default constructor not allocate memory.
Instead of bringing back the Q_GLOBAL_STATIC that was used, let's use
the short date time optimization on 32-bit too.
The CanBeSmall constant remains false on 32-bit systems, but judicious
non-use of that constant in a few functions allows 32-bit systems to use
the optimization. We still say that any date/time value is "unsmall", as
there's no sense in calculating whether the date is between 1970-01-01
and July 14 of the same year.
Change-Id: I413d458307aa46469b80fffd145a9db0325c08cc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
[ChangeLog][QtCore][QTimer] Added support for std::chrono duration
objects for QTimer methods, like QTimer::singleShot and
QTimer::setInterval.
Change-Id: I87e17314d8b24ae983b1fffd14536e24d5b12424
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Replace it with QL1S in QStringBuilder expressions
and in overloaded functions.
Replace patterns 'QString::number() + QStringLiteral'
and 'QStringLiteral + QString::number()' with
QString::asprintf.
Saves some text size.
Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In case a background task wants to use Qt, winmain is not invoked.
Neither can we create the same objects like winmain do (as in creating a
application view). Instead runOnXamlThread uses the thread pool enabling
the event loop to run successfully.
Task-number: QTBUG-54396
Change-Id: Ia3ba23ed0fd6cd7d2ed8d43675e88073b9aec8b5
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Make QProcess::startDetached() behave exactly like QProcess::start() when it
comes to the behavior of whether to create a new console window or not.
Before this patch, QProcess::startDetached() created a new console window
(CREATE_NEW_CONSOLE flag of CreateProcess()) unconditionally. Instead, use the
same rules for deducing whether to show an console window or not as
QProcess::start().
[ChangeLog][QtCore][Platform Specific Changes] QProcess::startDetached()
changed behavior on Windows: it no longer creates a new console window
unconditionally, instead it passes the same creation flags to CreateProcess
as QProcess::start().
Task-number: QTBUG-53833
Change-Id: I0e3d4b161fb5cb94cfbbd21fb4edb8417ab543fd
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
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>
Use the criterion that GNU coreutils' df uses: if the total size of the
filesystem is zero, then it's pseudo. After all, if it contains files in
a zero-sized volume, it has to be pseudo; if it contains nothing, then
it's not very useful anyway.
This would have caught most Linux pseudo-fs anyway, but the mount point
check beforehand allows us to skip quite a few statfs() syscalls.
The new algorithm also solves the following cases which had been
mistakenly interpreted:
* fuse and ZFS (source devices don't usually start with /)
* pseudo-fs that were mounted from a device starting with /
(the source device is usually ignored by the OS)
This change is not testable automatically. Manual testing shows it still
reports the same entries it used to on Linux, plus now shows FUSE
(sshfs) mounts.
Task-number: QTBUG-54235
Change-Id: Ib57b52598e2f452985e9fffd1459f06dcefcc5c6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This reverts commit dc0ae02ebc.
qdoc is a binary built inside the qttools repository, thus it should be added
to the respective ConfigExtras.cmake.in there instead.
Task-number: QTBUG-54446
Change-Id: I182e5889af164a89c68226a91abc4d9962a508ea
Reviewed-by: Volker Krause <volker.krause@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The new modular configuration system requires one global
header per module, that is included by all other files in
this module.
That header will later on #include the configuration file
for Qt Network. For now it defines the Q_NETWORK_EXPORT
macro for this library.
Change-Id: I9c45d425baf881c431ed71fd457c7feb2c123855
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The new modular configuration system requires one global
header per module, that is included by all other files in
this module.
A similar scheme and naming convention is already being used
for many other modules (e.g. printsupport, qml, quick).
That header will later on #include the configuration file
for Qt Gui. For now it defines the Q_GUI_EXPORT macro for
this library.
In addition, add a private global header, qtguiglobal_p.h,
that can later on include the private config header for
Qt Gui for things we don't want to export to the world.
Change-Id: Id9ce2a4f3d2962c3592c35e3d080574789195f24
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
1) In general it's unsafe to let exceptions propagate through Qt code,
so document that.
2) Add a note that overriding notify() makes sense only in Qt 5, in Qt 6
it's going away.
3) The advice applies also to applications not using QApplication, but
just QCoreApplication.
Change-Id: I4f6e74c53da757faf2eeaa9de226ceba55c52536
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
... and reject invalid ones. There was one error: we accepted schemes
starting with pluses, dashes and dots.
Change-Id: Ie585843cfb684bc3b6e3fffd145cfe12227ec4ad
Reviewed-by: David Faure <david.faure@kdab.com>
A Qt5 program writing a null QTime() using setVersion(QDataStream::Qt_3_3),
and then a Qt3 program reading that, would lead to a weird QTime,
with isNull=false, isValid=false, hour=1193, minute=2, second=47, ms=295.
This commit restores interoperability, by writing out the expected value
(0) for a null QTime rather than the -1 value used by Qt4 and Qt5.
Change-Id: Icde468a8f6fc9434ef7018296725819b44d672af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's really a kernel functionality, as it implements really low-level
functionality and it's used by the event dispatcher. It was in tools/
only because QTime is.
QDeadlineTimer is also coming to kernel/.
Change-Id: Ifea6e497f11a461db432ffff14491c6d9b839eb0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
... instead of creating a QDateTime object.
Change-Id: Ib57b52598e2f452985e9fffd145a36911de4fa9a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Replace substring functions that return QString with
corresponding functions that return QStringRef where
it's possible.
Create QString from QStringRef only where necessary.
Change-Id: Id9ea11b16947220cd27787c0b529de62d10b6c26
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
As noted in comments, QSortFilterProxyModel and QStandardItemModel
duplicate code to compare QVariant; extract this into a separate method
they can share.
Since there is only one common suitable header for both files,
the method was placed in qabstractitemmodel.cpp
Change-Id: I82bb4a2d6084059b8a70a8d556c16f1a29f4f686
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Serialization of the Qt container classes is accomplished by breaking
up the data into primitive units. On the receiver side, these units
should be read atomically to guarantee integrity of the container.
Deserialization procedures for QHash and QMap were already implemented
in accordance with this strategy and have the following behavior:
- a previously latched error status is saved for the caller. This
overrides possible different errors in the current read. This
is consistent with the treatment of primitive types.
- if an error occurs during the deserialization, the container is
cleared.
To make the API consistent, this patch adjusts the behavior of QList,
QLinkedList, QVector, and QSet deserialization. On the implementation
side we accomplish this with a private StreamStateSaver RAII class that
consolidates the handling of the stream status for all containers.
[ChangeLog][Important Behavior Changes][QtCore][QDataStream] Incomplete
reads of Qt containers are now handled same way as for primitive types,
meaning that previous errors are latched.
Task-number: QTBUG-54022
Change-Id: I5c77257fe2a4637e8a7e6cf3cd43091c8469340e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Be explicit on how to check whether parsing succeeds.
Change-Id: I44f408cb6e5a830826b84dfb3a8af331f03e58cc
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
It could be reached when QT_BOOTSTRAPPED was defined.
Change-Id: I632d6f908a3bcbde81a6ebbadcaf2800dfe1449d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Seems the previous check was a leftover from debugging. Tests still pass
and loop checks properly now.
Change-Id: Ic12cd49881f6d146687e257794b3028f6c8e874c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
to keep compatibility with and without
using QT_USE_QSTRINGBUILDER.
Change-Id: If8218fe0693cdb7ad1250beb272e0e7c356bbf4a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The rule was:
- if the header included qglobal.h, turn that into qglobal_p.h
- otherwise, insert the #include after the "We mean it" warning
qglobal_p.h currently only includes qglobal.h.
Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This also corrects for some code that was not included in the forward
merge from 5.6 (ea438b2508) due to code
restructuring.
Change-Id: I90a20fbcb60cfd6deb1cca3716a62754af27901f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The compiler didn't complain that they were unused or -Werror / -WX was
not active.
Change-Id: Ib57b52598e2f452985e9fffd145a7b63a32189fd
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
These new functions use a 64-bit integer in the API, instead of the
broken 32-bit unsigned integer that the previous xxxTime_t functions
used. That was a design flaw when the API was introduced back in Qt 4.2,
so I'm deprecating the API and slating it for removal in 6.0.
The changes to qfilesystemmetadata_p.h and quuid.cpp are necessary to
build the bootstrap library. The rest of the adaptation to the new API
will come in the next commit.
[ChangeLog][QtCore][QDateTime] Introduced toSecsSinceEpoch,
fromSecsSinceEpoch and setSecsSinceEpoch functions, which use 64-bit
integers to represent the number of seconds.
[ChangeLog][QtCore][QDateTime] The toTime_t, fromTime_t and setTime_t
functions are deprecated and will be removed in Qt 6.0. For new code,
use the equivalent functions with "SecsSinceEpoch" in the name, or the
equivalent ones with millisecond accurancy that have existed since
Qt 4.7.
Change-Id: Ib57b52598e2f452985e9fffd145a355d0e7ff48d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
A prior commit has already added the resetting of QMAKE_LFLAGS_NOUNDEF
in corelib.pro for FreeBSD due to environ(7) not being part of libc.
OpenBSD has the same issue, so add it to the list of BSD systems
affected for resetting the flags for qtcore.
Change-Id: I50a62271ffa05a9976e802de420d47a1425359c4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QT_HAS_BUILTIN is already defined in qcompilerdetection.h which is
included in qglobal.h which is included in this header file.
Task-number: QTBUG-54068
Change-Id: I46c2e13d85fc21d3e6c426d0f35a584b21ae792b
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
qdatetime.cpp(2834): warning C4312: 'reinterpret_cast': conversion from 'int' to 'QDateTimePrivate *' of greater size
Change-Id: Ib57b52598e2f452985e9fffd1458fe3ba3fcfb48
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
And blacklisted a few tests in tst_QUdpSocket.
Conflicts:
src/android/jar/src/org/qtproject/qt5/android/QtNative.java
src/corelib/global/qglobal.cpp
src/corelib/global/qsystemdetection.h
src/corelib/io/qfileselector.cpp
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
tests/auto/network/socket/qudpsocket/BLACKLIST
Task-number: QTBUG-54205
Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
This does not seem to be a function that is overloaded.
Change-Id: Icf8942dfb1e78a2ddb38cbd1c49657f745a61989
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Qt 5.8 no longer supports Windows CE, or versions of Windows where the
marketing version is not an orderable version number.
Change-Id: I8fab7d9b0d466f891e872b6c3fdf9d98ffe6ebc1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The clang based qdoc need to be able to parse properly anything that is
in #ifdef Q_QDOC
The #if for the forward declararion now match the one in which it is used.
Change-Id: Ia6cf84dd07a979b4e7aa8da764d9fb2fce74baa1
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Same as 9224255f13: some Qt types are
polymorphic and are marked as movable, so Clang complains.
qarraydataops.h:608:27: error: destination for this 'memmove' call is a pointer to class containing a dynamic class 'QPixmap'; vtable pointer will be overwritten [-Werror,-Wdynamic-class-memaccess]
qarraydataops.h:608:61: error: source of this 'memmove' call is a pointer to class containing a dynamic class 'QPixmap'; vtable pointer will be moved [-Werror,-Wdynamic-class-memaccess]
Change-Id: Ib57b52598e2f452985e9fffd145861e025b81550
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
It's a problem when building for 64-bit where the two types no longer
match.
Change-Id: I8c31915caf81a60d635c79816a3a2d5d36742ff9
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Otherwise, the code:
ds >> s >> hash;
could set the stream status to ReadPastEnd, while deserialization
of the string is failed with ReadCorruptData status.
Proposed solution is to restore a previously latched error status
unconditionally in accordance with QDataStream::setStatus() docs.
Change-Id: Id3a7dccf709b02e5b018efb48d7647ee48fe5124
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
0 must not be used as a null pointer constant
Change-Id: I082d0e99c105fb02980b9cf390e7f6e4c9ad0869
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- Adapt to the OS X => macOS rename in Q_OS_ macros/docs, qmake scopes,
file selectors, etc.
- Add new QSysInfo values and MAC_OS_X / __MAC_ / __IPHONE_ values for
macOS 10.12 and iOS 9.1 through 10.0.
- Update prettyProductName with new macOS "Sierra" codename.
Change-Id: Id976530beeafa01b648ebaa16f4a8f0613fcaf75
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The fromCGPoint function was left out for QSize, as the foundation type is
using CGFloats internally. Clients should use an explicit QSizeF::toSize()
when potentially throwing away precision.
Change-Id: I12d43ae0881f09ad8d79f2caaa000c3983f4ef30
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
The fromCGPoint function was left out for QPoint, as the foundation type is
using CGFloats internally. Clients should use an explicit QPointF::toPoint()
when potentially throwing away precision.
Change-Id: I12a37e8f81c86b7ada56066cc18ee29709cc21e3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Push conversions from pthread_t to Qt::HANDLE and back into functions.
The casts that were being used didn't work for the unusual 64-bit
pointer/32-bit int combination that QNX is using for 7.0. HANDLE ends
up as a 64-bit pointer and pthread_t ends up as a 32-bit integer. g++
considers the precision loss when converting from the 64-bit pointer
to the 32-bit integer an error. Better to have the casts hidden in
functions so it's easier to adjust them for unusual combinations such
as this.
Change-Id: Ia156b26224a0f7edc1c31e3d1ee8b21191381698
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
GetModuleFileName exists for Windows 10 and upwards, hence use the
generic version from the win32 mkspec. This allows to create a
QCoreApplication object with nullptr argv, as the application filename
is identified via the binary itself and not via arguments. A couple of
auto-tests use this method to create multiple application objects during
runtime.
Unfortunately we cannot apply this for msvc2013, even though MSDN states
the GetModuleFileName exists, it fails to compile for Windows Phone 8.1.
Change-Id: I2b8b988107487ef3785462f8ca40b0a6e0623e32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
In case QEventDispatcherWinRT::runOnXamlThread returns an error the
runtime sets the status of IAsyncInfo to Error. At the point when the
IAsyncInfo destructor is invoked, an unhandled exception is thrown
indicating the error has not been handled, causing any application to
just crash deep inside the Windows platform libraries.
Hence, in case runOnXamlThread returns non-S_OK we have to manually
invoke Close() of the IAsyncInfo to tell the system we have taken care
of everything.
Change-Id: I3ac1e2ec2726f42e44f4f9a92191e454711120dd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Q_COMPILER_CONSTEXPR can be undefined (or not defined at all) to
indicate that constexpr should not be used regardless of the compiler's
ability to support it. This is done for QNX because some C library
floating point functions used in the Dinkumware C++ library aren't
constexpr functions; i.e., the library doesn't have proper constexpr
support even though the compiler does.
(cherry picked from commit d87242968f)
Change-Id: If0bdeb2180710dd9ccd97d79fa91cf9ff42f7990
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The fromCGRect function was left out for QRect, as the foundation type is
using CGFloats internally. Clients should use an explicit QRectF::toRect()
when potentially throwing away precision.
Change-Id: I0d4c5c5a4e6a45ea3287e3f37a00b69b0bfdefcf
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
The move constructor is slightly more interesting than the copy
constructor because we can reset other to a short data state on 64-bit
systems. The assembly of that function is simply:
mov (%rsi),%rax
mov %rax,(%rdi)
movq $0x1,(%rsi)
retq
The move-assignment operator for QDateTime was already there. There's no
need for one for QDateTime::Data since it's never called.
Change-Id: I06bae9392f534e45b3f1ffff144dffdd7f23b170
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We won't shrink on manipulation when we have memory allocated, but it's
a good idea to create a non-shared copy if we can. It's an unlikely
scenario, though, because it requires the QDateTime object to have been
set to a large state then manipulated back into a small state.
Change-Id: I06bae9392f534e45b3f1ffff144dfee755bafa01
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The file has an organization, so let's follow it. This commit has no
other changes besides moving code around.
Change-Id: I06bae9392f534e45b3f1ffff144e0b1f6dd72622
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Well, maybe not for so long: we may want to revisit it for Qt 6. At the
very least, we should enlarge the size of QDateTime on 32-bit system so
that they too can benefit from the optimization.
With this optimization, on 64-bit systems, the most common uses of
QDateTime now no longer allocate memory at all. The range is slightly
reduced from 584,554,049 years to 2,283,414 years around 1970. The other
drawback is that calling QDateTime::offsetFromUtc() on a localtime now
needs to recalculate the offset, instead of using the cached offset.
(QDateTime::toMSecsSinceEpoch() didn't use the cache).
Change-Id: Id5480807d25e49e78b79ffff144a8b2c9af91814
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit moves QDateTimePrivate functions setTimeSpec, setDateTime,
getDateTime, checkValidDateTime and refreshDateTime outside the
class. Like the previous commit, this is done in preparation for the
"Short QDateTime Optimization" as the "msecs" field will be placed in
the short data, if possible.
By making them file-level static, this also improves code generation, as
the compiler doesn't know whether it has to emit the class members for
out-of-line use or not.
Change-Id: I06bae9392f534e45b3f1ffff144df4d73cbc9184
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit changes most accesses to the d->m_status (including
d->spec() and d->setSpec() uses) to use new static functions. This is
done in preparation to the "Short QDateTime Optimization" as the status
byte will be kept in the short data.
Change-Id: I06bae9392f534e45b3f1ffff144dbd795d03227a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Instead of using a macro for maybe passing an extra parameter, pass the
d pointer and let the function decide what to use and what not to use.
Change-Id: I06bae9392f534e45b3f1ffff144dbeb68a30cb48
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
They're superfluous, since b491fab02a
removed the distinction between null and invalid. Just use the
isValidXxx equivalents.
Change-Id: I06bae9392f534e45b3f1ffff144db9badad010fd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We're going to have to stop using QSharedDataPointer because of the
upcoming short-datetime-optimization. By dropping the inheritance, I am
also able to rearrange the members and remove the padding hole that
existed.
The second padding hole was removed in the previous commit, which merged
two 32-bit fields into one.
On 64-bit systems, there's no way around a remaining 4-byte hole
somewhere due to the odd number of 32-bit members. I chose to leave it
in the middle of the struct, before the m_timeZone member, instead of
tail padding, so that the layout of the first members structure are the
same in bootstrapped and non-bootstrapped builds. That should help
debugging the bootstrapped tools in Qt Creator. It's also now the same
in 32- and in 64-bit systems.
Change-Id: Id69569111e7d4e619e22ffff144b1fba708885f7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Storing them in a single byte is the first step towards the Short
QDateTime Optimization.
The bump in the "private version" by 10 is to accommodate possible
changes in the Qt 5.7 branch.
Change-Id: Id5480807d25e49e78b79ffff144a59420457bcf0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This makes it easier for users to find out how to get a file's
extension when browsing docs.
Change-Id: I08a1b620dea5432462133324824fae85754b9a09
Task-number: QTBUG-53380
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
On ABIs where quint64 is aligned on 8-byte boundaries (such 32-bit
Windows and all 64-bit systems), there was a padding hole of 4 bytes
between QHostAddressPrivate::a and the anonymous union. If we move the
member to after the union, there is no hole anymore.
That operation causes the tail padding to grow from 3 to 7 bytes. Since
we also don't need full 32 bits for the protocol, we can shrink the
structure by 8 bytes on those architectures and by 4 bytes on 32-bit
Unix systems.
Change-Id: I461e9fc7199748faa187ffff1415d6601a7bd777
Reviewed-by: hjk <hjk@theqtcompany.com>
The first is "exact", not "more": qCalculateBlockSize. It ensures that
there's no overflow in multiplying, adding the header size or when
converting back to an int.
The second is the replacement for qAllocMore: it calculates the block
size like the first, but increases the block size to accommodate future
appends. The number of elements that fit in the block is also returned.
Task-number: QTBUG-41230
Change-Id: I52dd43c12685407bb9a6ffff13f5da09f816e667
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The GCC builtins for clzs and ctzs are enabled when the x86 extension
for LZCNT and TZCNT are enabled. The use of only __BMI__ in commit
f5f47987ce was incorrect.
But GCC needs both BMI and LZCNT enabled to enable this builtin.
Change-Id: I1cc7601489634e96833cfffd145647e9fc9f2f51
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This works only on Aarch64, because the vaddv instruction is only
available on 64bit ARM. Doing something equivalent on 32bit ARM has the
high chance to run into micro-architecture differences: on an Cortex-a8,
transferring a single vector element from NEON to the regular CPU
registers takes 20 cycles(!).
Change-Id: Iccbfe84da82abb9b10f3f3dc35c8b950df69e251
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
GetTickCount64 is available on Windows Vista and WinRT. Since Windows CE
is no longer supported on dev, we don't need to dynamically resolve the
function anymore.
What's more, QueryCounterFrequency is documented to never fail since
Windows XP, so we haven't needed GetTickCount64 for years (no clue when
we dropped support for Win2k).
Change-Id: I115db302eb114bed8cd1fffd14558a81353d2aed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The implementation used the QString::compare_helper(QChar*, int, char*, int)
overload, which, however, interprets the rhs as a UTF-8 sequence, not as
Latin-1.
Fix by using the (QChar*, int, QLatin1String) overload.
Extend the test to cover this case, too.
Change-Id: I59b26d63d0caec036b80ef8818c75d0cebe519d2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When using a 8 bit encoding to write a file, a test discovers if the
encoding is really ASCII compatible by examining a letter and one of the
XML reserved characters. EBCDIC, in the current base, was not well
handled.
[ChangeLog][QtCore][QXmlStreamWriter] Fixed a bug that prevented the
generation of valid XML files when using encoding with 8 bit per
character but not ASCII compatible. QXMLStreamWriter generated XML
markup using always ASCII in this case.
Change-Id: I9c86a122dd91b2290d50c358638442f99777d4ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It doesn't like the attribute there. I think it's a compiler bug, but I
can't be sure because the part of the standard dealing with the
placement of attributes and where they apply is very complex. Exercise
left for the reader to determine if ICC is correct or not to reject it
there.
Change-Id: I87e17314d8b24ae983b1fffd1454bde826b7bcf4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Commit 9ef3ff30 introduced a new function, putUcs4(), to
output QChar, char16_t, char32_t as a, possibly escaped,
character literal, but got the order of stream modifiers
wrong. Instead of applying the field width to the 'ucs'
streaming, it applied it to the prefix '\u'. The same
problem exists for the pad char, leading to the result
'00\ue4'
for a QChar containing
ä (LATIN SMALL LETTER A WITH DIAERESIS)
Fix by reordering the elements streamed so that the
prefixes come last.
Added a test.
Change-Id: I6eaa0586501b9e780aaa3bb5dcec0e5c2f86a219
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Some constructors were added, but the comparison operators were missing.
The STL has them, so we ought have them too.
Change-Id: I030c14a3b355988f509716b4b1b1a835b3ab9481
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
When a copy is needed, replace_helper() takes
care of that for us.
Change-Id: I9e5c89cb70b2902c96062a9edaf77fedda6ddb2c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The old code iterated through one QJsonObject and looked up the key
in the other, comparing the values. It had linearithmic complexity,
and created one QString 'key' per element.
Since the entries in a QJsonObject are lexicographically ordered,
we can, however, just walk through the two objects in lock-step and
compare corresponding entries (at the same index) with each other.
Doing so saves O(N) QString creations and QJsonObject::value()
calls, and makes operator== linear in the number of elements.
Change-Id: Ib46ee0c1008b7f114454e282b6bd2bfcdbe59e2a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Since 5.0, this class is not abstract. Only the documentation of
updateCurrentValue was updated at that time. Fix the class reference and
the mentions of the class being abstract in the Animation Framework
overview.
Change-Id: I8ef9accb0b870dc8eb75bfc74361c7f2ad8d1d8b
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Some methods were already marked, this adds noexcept to even more methods.
Change-Id: I420bb1cc985058c7976ce3a1f251fadbba7ddceb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This makes the hash algorithm play nicely with qDebug.
Change-Id: I6db651cd5c73e8be65442dd68d6b865dcb975f4c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The \fn command to specify the function signature is not needed when
the documentation precedes the function itself.
Change-Id: I9de0d1ae73af443f0beded77538d62cea85b5e72
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Old versions of OpenBSD and NetBSD mkspecs had the QT_AOUT_UNDERSCORE
define declared in their qplatformdefs.h to support systems still
using a.out format. As those systems are long obsolete and the defines
are removed, remove the obsolete code, too.
Change-Id: Ia9e2f2d6de81fb182ef4c995b29062afe570b8b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Now that the minimum deployment target (and thus SDK) is 10.9 for OS X
and 7.0 for iOS, all code paths affecting platform versions lower than
the aforementioned are removed.
Change-Id: Id985c7259c4ac069319d88f2c29c9559ae9e8641
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Instead of placing the assignment of false in the impl() function, move
it to the inline QSlotObjectBase::compare() function. That means it's
assigned in one place (two, actually, inside qobject.cpp), instead of
for every static member, non-member or functor we connect or disconnect.
Change-Id: I87e17314d8b24ae983b1fffd1453623ad4c4dcb2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit also reverts fecaa6aae8.
The Microsoft documentation says _beginthreadex and _endthreadex are
used to initialize the C/C++ runtime and are necessary when linking to
libcmt(d).lib (that is, when using the -MT or -MTd options). For regular
builds linking against the .dll runtime, there should be no impact.
Inspection of the CRT source code which gets installed with Visual
Studio or Windows SDK proves that.
It's preferable to use CreateThread directly as _endthreadex will try to
call FreeLibraryAndExitThread, which can cause a deadlock if we try to
wait for the thread to exit from a global destructor.
For -MT builds, since there can be no DLLs, it's not a problem to
continue to use _beginthreadex and follow Microsoft's recommendation.
Task-number: QTBUG-53031
Change-Id: Id5480807d25e49e78b79ffff144af62c3c59dfe0
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Those enumerations and their associates are being deprecated,
and so the backing of their replacements cannot rely on it.
Change-Id: Id544aa757313065f435b5e66cd0475975cd5b825
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's required now in Qt 5.7 (at least the required features of rvalue
references and variadic templates)
Change-Id: I87e17314d8b24ae983b1fffd145364c52f9bb6c3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Pass the name as parameter to the constructor of QTemporaryFilePrivate
and use delegation in the convenience constructors.
Change-Id: I4087600b804fe22910b4985a59a02547f54a6acd
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Remove every usage of the _WIN32_WCE macro outside of 3rd party
source code directories.
Change-Id: Ia7e859bd6dcaef10c66674612c8e440f9a2dee56
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This merge also blacklists a flaky tst_QGL::clipTest test on
OpenSUSE 13.1.
Conflicts:
src/network/socket/qnativesocketengine_winrt.cpp
tests/auto/opengl/qgl/BLACKLIST
Task-number: QTBUG-53133
Change-Id: I14b431aa5a189b7dd1d3e2dfff767d15df20fde3
This reverts commit 2e4191eadc. The change
is backwards compatible but not forwards, so it can't appear past the .0
release.
Change-Id: I390c5e80795a9b3b27f6edcab79f7892a79c3564
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The assignment operator of a String QJsonValue that holds
the only remaining reference to the QString::Data block
was freeing the block before obtaining its own reference,
leading to a use-after-free in the case where *this was
passed as 'other' (self-assignment).
Fixed by reformulating the assignment operator in terms
of the copy ctor, using the copy-swap idiom, with the
twist that QJsonValue doesn't, yet, have a swap member
function, so we use three per-member qSwap()s.
Change-Id: I3c5ccc4d9f32c7593af3fc6a0edbf12b7feb1391
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
On OpenBSD, ffsll needs to be defined to compile. This is the
same change as in commit 725a9c2702
for NetBSD.
Change-Id: I3060caa10950a9419084a12de8c88a2f98b34d07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Until now, several solutions for the implementations of
processNameByPid() on BSD systems existed:
- one for FreeBSD using libutil through kinfo_getproc()
using sysctl() implicitly
- one for GNU/kFreeBSD using sysctl() explicitly added in commit
a8f4fa217d
OpenBSD and NetBSD also had different approaches in their ports patches
using kvm() and sysctl(). The code unifies this for all BSDs using
sysctl().
Change-Id: Iced9ef01e5966d8688f464f51024a7ed562e26a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Instead of placing the assignment of false in the impl() function, move
it to the inline QSlotObjectBase::compare() function. That means it's
assigned in one place (two, actually, inside qobject.cpp), instead of
for every static member, non-member or functor we connect or disconnect.
Change-Id: I87e17314d8b24ae983b1fffd1453623ad4c4dcb2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
They are needed for the header to be parsed properly with clang based qdoc.
While we are at it, change the condition from Q_OS_MAC to Q_OS_DARWIN
Change-Id: I2a2f9c1159f47795d9811023d67c86fec1866846
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Use qCountTrailingZeroBits and qCountLeadingZeroBits from qalgorithms.h
instead. Also extended these versions for MSVC. The _bit_scan_* versions
stem from a time before the glorious days of qalgorithms.h. A big
advantage is that these functions can be used on all platforms.
Change-Id: I5a1b886371520310a7fe16e617635ea335046beb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Consistently use setErrorAndEmit to emit errorOccurred and the
deprecated error signal.
Change-Id: I8bc7634a72d4d13f74bbf76547de08271dfcbb59
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Avoid unnecessary allocations.
Create QString from QStringRef only where necessary.
Change-Id: I8f2a7dce51430162c84328e23ab3cc071227d6ae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The _q_queueBytesWritten signal may be already queued from the event loop
at the time when stop() is called. We do not want to emit signals once
stopped, so reset all respective state variables.
Change-Id: I343e1702955e0bbc1d11930d19e75dab6e129b4c
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
NetBSD (pkgsrc) ports are building qt on Interix as well, where the
necessary defines are missing for in qsystemdetection.h.
Patch for adding them provided by NetBSD ports maintainer
Kamil Rytarowski <n54@gmx.com>
Change-Id: I769c47f623317efda3130a7061307e84d3350fac
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
...if a PMF connection had already happened. Since UniqueConnection
isn't implemented for non-PMFs (functors and lambdas aren't comparable,
even if static member functions or non-member functions are), we pass a
null pointer for comparison argument. The disconnect() code already
protected against a null pointer there, but not the connect code path
with Qt::UniqueConnection
Change-Id: I87e17314d8b24ae983b1fffd145324beced0494d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Dario Freddi <dario.freddi@ispirata.com>
It's inline, but the compiler did not inline it properly from Objective
C++ sources.
Undefined symbols for architecture x86_64:
"__Z18qt_getQtMetaObjectv", referenced from:
__ZN2Qt20qt_getEnumMetaObjectENS_15ScrollBarPolicyE in qlocale_mac.o
...
Change-Id: Ie9fd7afe060b4e4a8052fffd144fda60c50a9779
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When a process that locked a lockfile crashes on Windows, sometimes
a new instance of the process fails to lock.
Unfortunately, I can't find a way to reproduce the problem consistently,
but it happens from time to time with Qt Creator and Qbs.
There are several ways to detect a dead process on Windows. Some of
them can be found in stackoverflow[1].
The current implementation of stale lock detection is based on the
second answer (using WaitForSingleObject), but apparently it doesn't
work in 100% of the cases.
The most voted answer[2] (using GetProcessExitCode) proves to work also
on this case.
[1] http://stackoverflow.com/q/1591342/764870
[2] http://stackoverflow.com/a/1591379/764870
Task-number: QTBUG-53392
Change-Id: Ied7bf00985d0f12e833b887a0143f7bdeee3e772
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's not used anywhere in Qt and this was the only definition.
Change-Id: Id69569111e7d4e619e22ffff144daa82a1259cbd
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
The check in qglobal.h for __EXCEPTIONS is enough. This check here was
causing moc to define QT_NO_EXCEPTIONS
Change-Id: Id69569111e7d4e619e22ffff144daa661df4181d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
If the compiler supports C++11 alignof, let's use it. No point in
perpetuating the use of __alignof__ or __alignof.
There's a fallback implementation in qglobal.h that works even without
compiler extensions. We can't drop it just yet (alignas is not a
required C++11 feature), but at this point I doubt that fallback is used
anywhere anymore.
The tst_compiler test was wrong to use alignof(variable). That's not
permitted by the standard nor would it work with our fallback
implementation. MSVC 2015 enforces this, but ICC, GCC and Clang don't.
Change-Id: Ifea6e497f11a461db432ffff1448abfa86672c63
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
FreeBSD's clang currently is not able to handle thread_local calls due
to linker errors on __cxa_thread_atexit. The patch disables the
define Q_COMPILER_THREAD_LOCAL for clang __FreeBSD__ only, no functional
change. Otherwise, linking the tst_compiler autotest will fail.
For details, see
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192320
Change-Id: I2395c06499d4821213e2154769ccbeed3dcf1ffe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Let QQuickStyleSelector in Qt Quick Controls 2 re-use the same
selection helper implementation.
Change-Id: I34cbba0aa178e342bb4004313e7ff56811e6be19
Reviewed-by: Liang Qi <liang.qi@qt.io>
Also made a small comment fix
Task-number: QTBUG-53605
Change-Id: Ica9a06fe7a70f92f2a19a6df3ffdeaf1985e2eb6
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
It was added in 2.6.22. If we pass it to 2.6.21, we'll get -ENOSYS,
which is bad for QMutex. This fix simply defines it to 0 if the header
doesn't define it.
But as a consequence: if Qt is built with newer kernel headers, it won't
run on older versions. It's not likely that someone is still using Qt
5.7 on a 2.6.21 kernel (v2.6.21.7 was released on 2007-08-04).
Change-Id: Icb178bb113bb437c9b67fffd1451dd7bb964f0c8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This allows us to pass pointers to storage that is not an array of
uchar, which it hardly ever is.
Change-Id: Ifea6e497f11a461db432ffff14490d2c2df21906
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
E.g. for a string of length 16, with i == 0, this loop can still run.
Same for the case where length is 8.
Change-Id: Ie95832b50ddeba2e0dfb0e3308e4c7a5376bb969
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Just being on ARMv8 does not mean CRC32 (and arm_acle.h) is available.
Task-number: QTBUG-53629
Change-Id: I104f643f2d59620e1f4d1ef814a1de71bb484e7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Move the Q_ALWAYS_INLINE and forcing of __builtin_memcpy to the existing
functions.
Change-Id: Icaa7fb2a490246bda156ffff143c137e520eea79
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
On OpenBSD, <sys/select.h> isn't included in <sys/types.h>, so that
leads to compile errors on files that include qcore_unix_p.h:
qcore_unix_p.h:335:69: error: 'fd_set' has not been declared
Just move the whole select include section from qcore_unix.cpp, no
functional changes.
The patch is adapted from OpenBSD ports maintainer Vadim Zhukov
<persgray@gmail.com> patch for qt ports.
Change-Id: I35ba693440b1c1644bcfcdb69823e2b37870ad97
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's there and it's more efficient anyway.
Change-Id: Ie9fd7afe060b4e4a8052fffd144fc40647430268
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
POSIX.1-2001 allows quoting a zone name so that it can contain other
characters besides letters, by enclosing it in angle brackets ('<' and
'>'). This hadn't been used until recently (tzdata2016b), when the
Asia/Barnaul rule started using a zone name "+07" (the name variable
contained the value "<+07>-7").
Thanks to Paul Eggert for reporting and investigating the root cause.
Task-number: QTBUG-53071
Change-Id: Id5480807d25e49e78b79ffff1449bc410776cb66
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This reverts commit 4579d966af.
This causes a miscompilation with ICC 16 on Windows (MSVC 2015 ABI): the
vector created by new[] with () in:
mutexes(new QAtomicPointer<QMutex>[size]()), // (): zero-initialize
does not actually zero-initialize (see disassembly in the bug
report). This is definitely a compiler bug.
Since we plan on removing QMutexPool in Qt 5.8 anyway, let's just revert
the patch.
Task-number: QTBUG-53360
Change-Id: I06bae9392f534e45b3f1ffff144e823b747e7962
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
I'm not sure how one of my machines has this problem and the other
doesn't (same distribution and same compiler version). Must be operator
error. But this is required to compile QtGui when QtCore was compiled in
LTO mode.
qversiontagging.cpp used to be built with -fno-lto before commit
629ceec208. This commit restores that
functionality, but not the clang "-no-integrated-as" part.
Change-Id: Ie9fd7afe060b4e4a8052fffd144fb9c1a1166854
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This info wasn't really very helpful, and would anyway always
contain either Preview, OpenSource or an empty string for
commercial users.
Change-Id: I311b991834fa83cf1a183083acd5112cda3d2e41
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Compile fix for NetBSD's use of statvfs having f_flags.All other BSDs use
statfs instead of statvfs, so the f_flags define needs to be prevented
on NetBSD.
Fix obtained from Kamil Rytarowski <n54@gmx.com>, NetBSD qt ports
maintainer.
Change-Id: Ifbd7ba0cba7f6cf280f5984c64abd7649f667332
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The local variable isEmpty triggers a compile warning with GCC:
variable ‘isEmpty’ set but not used [-Werror=unused-but-set-variable],
so remove the variable assignment and declaration.
Error is triggered on FreeBSD and NetBSD with gcc.
Change-Id: I37bdb3408ad69093708f2d4bdb04392da66e04e5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On NetBSD, ffsll needs to be defined to compile. The fix adds the
according Q_OS_NETBSD define to the list of operating systems
needing the define.
Fix obtained from NetBSD port maintainer Kamil Rytarowski <n54@gmx.com>
via IRC.
Change-Id: I966a7b3fba43fb56e72f19f6b7f7cacc19c3c6cf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
GCC creates a warning "enumeral and non-enumeral type in conditional
expression" as the types of the two arguments don't match. Fix
the compile warning by converting the first argument to (long) to match
the type of the second parameter.
Fix confirmed to work on NetBSD and FreeBSD, obtained from
Kamil Rytarowski <n54@gmx.com>, NetBSD qt ports maintainer.
Change-Id: I777dd066a0a8cc8a46e34bd39b256882080a7773
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On NetBSD, the types uint64_t, uint32_t and uint8_t
are already defined in sys/types.h which leads to compile errors.
Those types need to be properly undefined before defining
them with the Qt code.
Change-Id: Icd58f421619f15b899cf5c5de1cfb22a519a4e4b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Besides FreeBSD and NetBSD, OpenBSD uses kqueue too, so
add the according Q_OS_OPENBSD define here to make that work.
Patch obtained via OpenBSD qt ports maintainer Vadim Zhukov
<persgray@gmail.com> from OpenBSD qt ports patches.
Change-Id: Ib9e6f6303b661beb88666bd3c2bf36a77e929f9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Affects systems like the NVIDIA DRIVE CX. This did not show up so far
because there was no error when Q_PROCESSOR_ARM was not set.
Task-number: QTBUG-53493
Change-Id: I107155b6dc1a881eca6f57374ad8db4458875243
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
8c3ae221 introduced a mean to actually close an application. Otherwise
the application was in an undefined state and did not exit.
Since 5.6 we switched to Xaml and the explicit call to Exit() is not
required anymore. This also allows using multiple application objects
sequentially as the unit tests do in some cases.
Change-Id: I9030afec72a4534e818c77c373dc3a81b922a480
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Makes it easier to apply similar changes across all related functions,
and to implement functions for new types by having the previous
approaches available in one place.
Change-Id: I3f0590d67d0e6deb1c6c856ab1de96b55b6af058
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Pass -xplatform macx-tvos-clang to configure to build.
Builds device and simulator by default.
Added ‘uikit’ platform with the common setup.
Also added QT_PLATFORM_UIKIT define (undocumented).
qmake config defines tvos (but not ios).
tvOS is 64bits only (QT_ARCH is arm64) and requires bitcode to be
embedded in the binary. A new ‘bitcode’ configuration was added.
For ReleaseDevice builds (which get archived and push to the store),
bitcode is actually embedded (-fembed-bitcode passed to clang). For all
other configurations, only using bitcode markers to keep file size
down (-fembed-bitcode-marker).
Build disables Widgets in qtbase, and qtscript (unsupported,
would require fixes to JavaScriptCore source code).
Qpa same as on iOS but disables device orientation, status bar, clipboard,
menus, dialogs which are not supported on tvOS.
Change-Id: I645804fd933be0befddeeb43095a74d2c178b2ba
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Remove _POSIX_C_SOURCE usage as the reason why it was added is not
clear anymore and it causes compile errors on BSD systems if not
circumvented by adding further defines to re-enable function calls
hidden by the _POSIX_C_SOURCE define. (__BSD_VISIBLE on FreeBSD/OpenBSD
and _NETBSD_SOURCE on NetBSD)
Change-Id: Ic6b49ddcd6c481b0f2acd598cea5470604e00507
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We can now directly use CancelIoEx. The fallback to CancelIo
was needed for supporting Windows XP.
Change-Id: I24a53a774caf695e6006f24a914abaa5ab204035
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
QVariant::canConvert<Enum> was returning true for everything can can be converted
to integer, but not for integer itself. That's because in QVariant::canConvert
we set the targetType to Int of it's an enum, but the Int->Int case was not
on the conversion matrix. So this commits adds it to the conversion matrix
and now QVariant::canConvert<Enum> returns consistently true for int itself.
But even tough canConvert returned true, it did not actualy do any conversion
to the enum type itself. Fix that by handling the case properlt in 'convert'
[ChangeLog][QtCore][QVariant] Fixed QVariant::canConvert and conversion from
integer types to enumeration types.
Task-number: QTBUG-53384
Change-Id: I6ac066f3900e31bfcea7af77836ddfc7730bd60b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
7edd10e6c added this compression feature, but some applications may
need to disable it.
[ChangeLog][X11] It's now possible to unset AA_CompressHighFrequencyEvents
to disable the new X event compression feature that was added in 5.6.0.
This is a replacement for the WA_NoX11EventCompression flag in Qt 4.
Task-number: QTBUG-44964
Change-Id: I37a9c8a4831f1c02eda0f03b54125f3255d25500
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This will make it easier to use create backtraces in other contexts.
Change-Id: I56b838ab04d9810108fcdb7f8c2fd91255864850
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The <QHash> only contains the container these days,
while <QHashFunctions> contains the qHash() function
overloads and related functions. This is where these
two functions belong, too.
This change is BC and SC, since qhash.h includes
qhashfunctions.h.
Change-Id: I2e7febb0ffca209af67fb9f2cd363596867a44e1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
15b42af111 changed the qt_cpu_features
variable to be an array and never fixed this #if branch of the code.
Change-Id: Id69569111e7d4e619e22ffff144cf930f86f478e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
In order to avoid pulling in QDebug when including QSharedPointer.
Change-Id: I14b86d1f100ed44a68258c91bbda394b655bac83
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
...from the docs of the signals it emits.
Task-number: QTBUG-53228
Change-Id: Ifdd91404cae9dd6480ae29b31f2a48fa024df442
Reviewed-by: Nico Vertriest <nico.vertriest@theqtcompany.com>
Examples in binary packages now directly match the install path.
Change-Id: Ic1487bc766cfd3b0a0a340cc4ae4ba49d953eaa6
Task-number: QTBUG-52953
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Set the error mode flag SEM_NOOPENFILEERRORBOX when calling Win32 API
GetLogicalDrives() to prevent it from prompting to insert media
as does QStorageInfoPrivate::mountedVolumes().
Task-number: QTBUG-18729
Task-number: QTBUG-32457
Change-Id: I5c76afbb5bf2ec5ec84194650c316fe531578d5b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The flag was introduced in kernel 2.6.22, but we're already depending on
features added on 2.6.23 in qcore_unix_p.h (pipe2, dup3, O_CLOEXEC) and
2.6.27 in qnet_unix_p.h (accept4 and SOCK_CLOEXEC).
Change-Id: Id5480807d25e49e78b79ffff144a093c9e30cd96
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Port the last remaining Q_FOREACH user in QtCore to
C++11 range-for and mark QtCore, QtSql and QtDBus as
Q_FOREACH-free, using QT_NO_FOREACH.
Change-Id: Ia6f99139cb1ca4a8bbe9e445421592242e048b0a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It has been known for a long time that Q_FOREACH produces
inferior code to other looping constructs, and the use of it
in Qt library code was informally frowned upon since forever
(pun intended).
Yet, to this day, several thousand foreach/Q_FOREACH loops
have been added to Qt libraries, and while many were ported
to range-for in Qt 5.7, there are still new ones added every
day, which is a nuisance, to say the least.
This patch introduces a technical way to prevent new foreach
use to creep into Qt libraries after they have been cleaned,
by simply not defining either Q_FOREACH or foreach when the
QT_NO_FOREACH macro is defined. This way, one library at a
time can be ported away, and, once ported, is guaranteed to
actually stay ported.
Change-Id: Ie042e84d6c7d766bd16095f9bc1118a8e0ce0c7a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I0d6065fbdd19acff14072ff626585e8a12a3e073
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... or if it is less than ARMv5. The last ARMv4 Qt supported was Windows
CE 7, which was dropped for Qt 5.7 alongside MSVC 2008.
Change-Id: Ifc817705441a4aab9469ffff141dcfe491464efa
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Allows to get rid of some QStringLiterals, reducing QtCore
text size by ~800b.
Change-Id: I8f7e57927163eaaf628e42020f83f053faea6bf8
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
QXmlStreamReader also has QLatin1String overloads, which
greatly benefits parsers, since the vast majority of keys
in both JSON and XML are US-ASCII. This patch adds such an
overload to the JSON parser.
The value() function is all typical parsers need, so even
though many more QJsonObject functions taking QString could
benefit from the same treatment, value() is the single most
important one for read-only JSON access.
Add some more overloads, too, for functions that don't need
more internal scaffolding than value(). Requires adding a
dummy op[](QL1S) (forwarding to the QString overload) so as
not to make
QJsonObject json;
json[QLatin1String("key")]; // mutable
ambiguous between const op[](QL1S) and mutable op[](QString).
[ChangeLog][QtCore][QJsonObject] Added value(), op[] const,
find(), constFind(), contains() overloads taking QLatin1String.
Change-Id: I00883028956ad949ba5ba2b18dd8a6a25ad5085b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
a63ca3fa10 caused a build breakage
for WinRT as GetModuleHandleEx does not exist on that platform.
Change-Id: I143d9cad5f32d98a4d86292dfa73f94a4acdf305
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
... with known size and known char by corresponding ctor.
Don't use fill() for this case.
Change-Id: I475a0655132ecbb40b1eac919309597b2560e71b
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
our zlib header includes qglobal.h, so we need the qtcore include dirs,
and qtcore is also where the actual code is compiled into.
Change-Id: I09f530a1b4e6160438215a6d7223c0771ce94f05
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
!isComplex is quite good heuristic, but we know for sure which types
should be included.
Change-Id: I609d021b8a668e6c1945ed2b11d69f5a82b5e2bf
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The vast majority of users call toString() without the optional
defaultValue. So do it like the toArray() and toObject() methods
and split toString() into two overloads, so the common case no
longer needs to pass a temporaray QString.
Saves ~1.4 and ~1KiB in QtCore and QtGui text size, resp., on
optimized GCC 6.0 Linux AMD64 builds, even though we added a new
function to QtCore, too.
Change-Id: Ibe02397ca49ce11fdb58f5c5fc69e909bf94c1c6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This is source- and binary-compatible, including the marking of the
existing function as noexcept.
[ChangeLog][QtCore][QMutex] Made the isRecursive() method be a const
function so that it can be called in const QMutex objects too.
Change-Id: Ifea6e497f11a461db432ffff1448bead97c08f92
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
They won't be listed in QStorageInfo::mountedVolumes, but we can now
obtain their info if you know their mountpoint. For example, on Linux:
$ ./qstorageinfo /dev /proc /sys
Filesystem (Type) Size Available BSize Label Mounted on
devtmpfs (devtmpfs) RW 4029772 4029764 4096 /dev
proc (proc) RW 0 0 4096 /proc
sysfs (sysfs) RW 0 0 4096 /sys
Change-Id: I3e15a26e0e424169ac2bffff1417ba2429d6d9f4
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This happens for me with LVM:
$ ls -l /dev/mapper/system-root /dev/system/root /dev/disk/by-label/*
lrwxrwxrwx 1 root root 10 Nov 17 22:45 /dev/disk/by-label/system -> ../../dm-1
lrwxrwxrwx 1 root root 7 Nov 17 22:45 /dev/mapper/system-root -> ../dm-1
lrwxrwxrwx 1 root root 7 Nov 17 22:45 /dev/system/root -> ../dm-1
The mounted device according to /etc/mtab (/proc/self/mounts) is
/dev/mapper/system-root.
Change-Id: I3e15a26e0e424169ac2bffff1417b96779d84246
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Allow tmpfs filesystems to be reported, as they're often usable by the
user, mounted in /tmp and in /run (the fs for $XDG_RUNTIME_DIR).
But disallow anything whose device is not a pathname. This catches most
of everything else that wasn't specifically tested for before, like
virtual fuse filesystems, like GVFS.
Change-Id: I3e15a26e0e424169ac2bffff1417b7cee0f8ec97
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The path "/usrfoo" starts with "/usr", so if you tried to get
QStorageInfo("/usrfoo") when "/usr" is a mount point, you'd get the
wrong filesystem.
[ChangeLog][QtCore][QStorageInfo] Fixed a bug that caused QStorageInfo
to report information for the wrong filesystem if there is a mounted
filesystem at a path that is a prefix of the requested path (e.g., it
would report "/usr" filesystem for "/usrfoo").
Task-number: QTBUG-49498
Change-Id: I3e15a26e0e424169ac2bffff1417b7a27cd0132d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
We were using direct loading and operator=, which for everything except
std::atomic was very relaxed. But std::atomic<T *> defines the direct
access to actually be the least relaxed possible, under the idea that if
you didn't know any better to use a member function, you probably need
the most protection.
So use Ops::load and Ops::store.
Change-Id: Id5480807d25e49e78b79ffff144a06a2e6398576
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
ICC 15.x and 16.0 (beta, at least) are missing the "constexpr" and
"noexcept" keywords in the definition of the std::atomic
constructors. The lack of constexpr makes std::atomic a non-literal
type, which in turn makes QBasicAtomicInteger's constructor (which is
constexpr) fail to compile.
Reported as Intel issue 6000117277.
Change-Id: I4a88bcca48bf0ce51557d809ef32a4545edcafee
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
It always returns the same information for each thread it is called
in. But since it's different per thread, we don't think it's
const. pthread_self() on Linux is marked const, though we think it
really ought to be pure. On other OSes, the annotation isn't present,
but the we can assume function is so.
Change-Id: Ifea6e497f11a461db432ffff1448c2b37d94d5f3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
It's interesting that the HMODULE/HINSTANCE pointer points to something
in the actual module that got loaded, so we can use its value as
"address of something in the module" for GetModuleHandleEx. The "PIN"
flag tells the Windows DLL loader to never unload.
Change-Id: Ifea6e497f11a461db432ffff1449a2169eb6293e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Since I'm changing QDateTime's privates, it's easier to know what may be
depending on it or not.
Change-Id: Id5480807d25e49e78b79ffff144a53018d057e19
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The article describes two ways, not three.
Change-Id: I2b8b3c92135dd87de8a81255cddd1faf7c5455c3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The C and C++ standards say it's undefined whether the preprocessor
supports macros that expand to defined() will operate as an ifdef.
Clang 3.9 started complaining about that fact.
One solution was to change QT_SUPPORTS to check for zero or one, which
means we need to change the #defines QT_NO_xxx to #define QT_NO_xxx 1.
The C standard says we don't need to #define to 0, as an unknown token
is interpreted as zero. However, that might produce a warning (GCC with
-Wundef), so changing the macro this way is not recommended.
Instead, we deprecate the macro and replace the uses with #ifdef/ndef.
Change-Id: Id75834dab9ed466e94c7ffff1444874d5680b96a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This patch allows handling of special block devices in random-access
mode that restores a Qt4 behavior.
Can not be tested because requires root privileges in the system.
Task-number: QTBUG-51666
Change-Id: Iaa56355f1be343c0d05b292e3c7d2e1c88724529
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Andrius Štikonas <andrius@stikonas.eu>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
That's required so that they remain in the output from the preprocessor
Change-Id: Id69569111e7d4e619e22ffff144b4a1ee90865f0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... instead of using erase() in a loop, with quadratic complexity.
Change-Id: I277ff2527e0a22b3d754b1d14296b9882f164c23
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This includes:
- have nothrow member-swap
- have ADL non-member swap
- not specialize qSwap or std::swap
Also prevent QScopedPointer <-> QScopedArrayPointer swaps by overloading
swap (both member and non-member) on QScopedArrayPointer. It's not 100%
safe, but it's what we're doing elsewhere (QMulti(Map,Hash), say).
That's technically a SiC change if users expected (qualified) std::swap
to invoke QScopedPointer::swap(), but those users were doing it wrong to
begin with, and they now get a compile-error instead of silent pessimization,
because generic std::swap() doesn't work on QScopedPointer, due to lack
of copy (and thus move) semantics.
Change-Id: I3ab5c1668722a2c8ccafc16f57310ce8d4bffbd6
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QPluginLoader hasn't unloaded in its destructor since Qt 5.0, but we
missed the equivalent code in QFactoryLoader (which bypasses
QPluginLoader). Besides, QPluginLoader::unload() was still doing
unloading, which it won't anymore.
Not unloading plugins is Qt's policy, as decided during the 5.0
development process and reaffirmed now in 5.6. This is due to static
data in plugins leaking out and remaining in use past the unloading of
the plugin, causing crashes.
This does not affect QLibrary and QLibrary::unload(). Those are meant
for non-Qt loadable modules, so unloading them may be safe.
Task-number: QTBUG-49061
Discussed-on: http://lists.qt-project.org/pipermail/development/2015-November/023681.html
Change-Id: I461e9fc7199748faa187ffff1416070f138df8db
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
It's easier to maintain the function and the docs when they live together.
Change-Id: I1e047b4ac1eb61a36849188da560dd899e05509f
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
We don't need to include Q_QDOC in the forward-declarations of the native
types, and Q_FORWARD_DECLARE_OBJC_CLASS works in non-Objective-C mode as
well, which means we can declare the Objective-C versions of the functions
without guards.
Change-Id: I32089c496b4f7ce47f0388ba3f65e0b091d1e9ee
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
as in other examples which come with plugins, use an additional
hierarchy level which contains the app and plugin subdirs.
Change-Id: I2487755967aa3474c337c8c8af10be49627b63d0
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
When using QML, it quite often happens that only the QML engine is
connected to a signal, and no C++ handlers. By splitting up the
fast-exit case and handling QML separately, we can prevent a call to
QThread::currentThreadId, and locking+unlocking the mutex.
On x86 this saves ~130 instructions according to valgrind.
Change-Id: I947fe42afe351922339ac982a6d498bc2f7b5192
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The printf-style version of QDebug expands to a lot less code than the
std::ostream-style version. Of course, you pay in type safety (but
compilers warn about it these days), you cannot stream complex Qt
types and streaming QStrings is awkward, but in many cases you
actually improve on readability.
But the main reason is that something that's not supposed to be
executed under normal operation has no business bloating executable
code size.
This is not an attempt at converting all qWarnings() to printf-style,
only the low-hanging fruit.
In this second part, replace
qWarning() << "" << non-QString
with
qWarning("..%.", non-QString).
QString (and QUrl etc) have special escaping handling when streamed
into QDebug, so leave those alone. They also seem to expand to less
code than the qPrintable() alternative, so there's no reason to
replace them.
Saves 2KiB, 3.4KiB, ~750b and ~450b in text size in QtCore, Gui,
Network and Widgets, resp., on optimized GCC 5.3 AMD64 builds.
Change-Id: Iae6823e543544347e628ca1060d6d51e3b04d3f4
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Implementation of QFileSystemEngine::copyFile() uses CopyFile2() as if
it is CopyFile() function, but CopyFile2() returns HRESULT, not BOOL.
So the success should be checked by "SUCCEEDED()" instead of "!= 0".
Current implementation does exactly the opposite because S_OK == 0.
Change-Id: I0677d54447d22366fb2031e0b928a3d10e24c0ed
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
The problem of the check is that it makes Qt non compliant with OpenGL
thread affinity semantics. One is allowed to make a GL context
current on any thread, without the Qt-specific idea of moving
the QOpenGLContext to that thread first. Moreover, the move is
plain impossible if the user needs to handle the context
to 3rd party code which assumes the context to have GL semantics.
Add an application flag to disable that.
Change-Id: I55ca02ee62f8cc171a9a1bddef5331ad0949c061
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This rectangle represents the "effective" visual rectangle of the input
item, excluding any areas obscured due to clipping.
Note: The effective visual rectangle will not be influenced by overlapping
items.
Change-Id: I234176161dcfb9c236124e33ae510a0b01fe6dc3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
The store to guard in the inner function's critical
section was not synchronized-with the load at the
start of the function:
T1 T2
guard.load()
mutex.lock()
guard.load()
d = new Type
guard.store()
guard.load()
// use d
mutex.unlock()
The use of d in T2 does not synchronize with
the write to d in T1 -> data race -> UB.
Fix by storing with release memory ordering,
so that the guard.load() in T2 synchronizes
with the guard.store() in T1.
Change-Id: I5c1cd1fa097c6397cb0b48b0d8e8012f95978558
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Change-Id: I3d9f84d03519b2b8fb37c7d2e773e68bc4b9a1d3
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
QWindowsPipeWriter uses asynchronous API to perform writing. Once a cycle
has been started, the write buffer must remain valid until the write
operation is completed.
To avoid data corruption and possibly undefined behavior, this patch
makes QWindowsPipeWriter::write() take a QByteArray, which it keeps alive
for the duration of the write cycle.
Autotest-by: Thomas Hartmann
Task-number: QTBUG-52401
Change-Id: Ia35faee735c4e684267daa1f6bd689512b670cd2
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
In particular, just creating a QFileInfo (or a QDirIterator, which uses
QFileInfo internally) no longer triggers decompression. This doubles the
performance when using a QDirIterator/QFile combo for loading a bunch of
files.
Change-Id: I7f53354e890ad6360693b7848d21a0cd5d595628
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Remove documentation of enumeration values and code from manual test.
Change-Id: I8e6cbbe11ab38421fb29595ae79351f5a919ff70
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
It was being stored once in QThreadPrivate and once in QThreadData, with
the latter being hidden as a Qt::HANDLE. Besides saving a little bit of
memory, this also solves a small data race condition that arises from
trying to connect a signal to an object moved to that thread and then
emit that signal shortly after the thread starts. Before this patch,
QThreadData::threadId was initialized only by QThreadPrivate::start(),
which meant that we were racing that initialization with this check in
QMetaObject::activate:
const bool receiverInSameThread = currentThreadId == receiver->d_func()->threadData->threadId;
Task-number: QTBUG-52337
Change-Id: Ifea6e497f11a461db432ffff1449ae01f1099aae
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
The reference to trUtf8() made it even more confusing, so remove it.
It's redundant and deprecated anyway.
Change-Id: I9921297160db3660bb5099692bbfdaf6e85637aa
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Where "correct" is defined by what std::shared_ptr does as well as what
happens when an intermediate QSharedPointer of the exact type of the
constructor behaves
That is,
QSharedPointer<X> ptr(new Y);
Behaves like
QSharedPointer<X> ptr;
{ QSharedPointer<Y> tmp(new Y); ptr = tmp; }
Change-Id: Id75834dab9ed466e94c7ffff14455d445f72592b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
It was hidden by overridden parent(const QModelIndex &) methods.
See also 63b5082ea8
(Unhide QObject::parent() from QAbstract{Table,List}model).
Change-Id: I8b6d4d4175e4d43ff269eaeb0b2b1a9fb8f44bab
Task-number: QTBUG-45393
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
If the container being added to is default constructed and has never
been modified, we don't have to do all the checking and iterating.
Instead we can just assign with operator=.
If the LHS is merely empty, we could lose reserve()d capacity, so only
do this for a shared-null LHS.
Change-Id: If1e3342662d10833babc7ab847ada0285073723b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
The proper solution with qCalculateBlockSize will come for Qt 5.7.
Change-Id: Ifea6e497f11a461db432ffff14490788fc522eb7
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Override preceding Common-s with a subsequent non-Inherited,
non-Common script.
This produces longer script runs, which automagically improves
the shaping quality (as we don't lose the context anymore),
the shaping performance (as we're typically shape a fewer runs),
and the fallback font selection (when the font supports more
than just a single language/script).
Task-number: QTBUG-29930
Change-Id: I1c55af30bd397871d7f1f6e062605517f5a7e5a1
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
[ChangeLog][QtCore][QLibraryInfo] Added QLibraryInfo::version(), which
returns the current version of the Qt library as a QVersionNumber
object.
Change-Id: Ifea6e497f11a461db432ffff1448d4dc84ef57b1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Since they are non-characters and should not be used for text
interchange, it stands to reason that they should not appear in
unencoded for in a URL. To change the behavior, we just need to toggle
a simple flag for QUtf8Functions.
This behavior also matches the recommendation from RFC 3987. We do not
usually follow recommendations from that RFC (as it is generally
believed to be a bad RFC), but this one seems like a good idea.
Change-Id: Ifea6e497f11a461db432ffff1447486c623c12bd
Reviewed-by: David Faure <david.faure@kdab.com>
Similar change to 390ea21873, but more
extensive because the hash variables were not, yet, of unsigned type.
This brings the three hashed string search algorithms in QtBase (in
QString, QByteArray and QByteArrayMatcher) in line again.
Found by UBSan, fixing the following bunch of errors:
tools/qstring.cpp:3080:38: runtime error: left shift of negative value -1291179264
tools/qstring.cpp:3081:42: runtime error: left shift of negative value -1291179264
tools/qstring.cpp:3091:13: runtime error: left shift of 73 by 26 places cannot be represented in type 'int'
tools/qstring.cpp:3091:13: runtime error: left shift of negative value -1255957171
tools/qstring.cpp:3091:13: runtime error: signed integer overflow: 1783052986 - -1207959552 cannot be represented in type 'int'
tools/qstring.cpp:3097:37: runtime error: left shift of negative value -1298753576
tools/qstring.cpp:3098:41: runtime error: left shift of negative value -1298753576
tools/qstring.cpp:3107:13: runtime error: left shift of negative value -1508912760
tools/qstring.cpp:3158:38: runtime error: left shift of negative value -677037574
tools/qstring.cpp:3159:42: runtime error: left shift of negative value -677037574
tools/qstring.cpp:3169:13: runtime error: left shift of negative value -1657715810
tools/qstring.cpp:3173:38: runtime error: left shift of negative value -677037574
tools/qstring.cpp:3174:42: runtime error: left shift of negative value -677037574
tools/qstring.cpp:3183:13: runtime error: left shift of negative value -1657715810
Change-Id: I1436eb61369919df9fe34251f863dd54fb58af98
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The MSVC STL warns when passing naked pointers as non-bounded
iterators to algorithms such as std::equal and std::copy, in
an attempt to inform users that the range specified by that
iterator has an implicit minimum size that the caller of the
algorithm must ensure is met:
warning C4996: 'std::_Equal1': Function call with parameters that may be unsafe - \
this call relies on the caller to check that the passed values are correct. To \
disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to \
use Visual C++ 'Checked Iterators'
When building Qt, as well as when building user projects with
qmake (cf. 0a76b6bc7f), we
globally disable this warning (with -D_SCL_SECURE_NO_WARNINGS),
but since we started using STL algorithms in public headers (e.g.
in qvector.h), users get this warning in their own projects now,
unless they, too, define said macro. But such a requirement is
against the Qt policy to have headers that are warning-free as
much as possible.
The suggested way of fixing this warning is to wrap the naked
pointer in a stdext::unchecked_array_iterator before passing it
to the algorithm, cf. examples in
https://msdn.microsoft.com/en-us/library/ttcz0bys%28v=vs.120%29.aspx
or, together with the capacity-made-explicit, in a
stdext::checked_array_iterator.
To avoid ifdefs for platforms that don't have these extensions
(which, incidentally, for the unchecked case, includes MSVC 2012),
wrap the calls in macros.
The end game here is to drop -D_SCL_SECURE_NO_WARNINGS, at least
for public headers, even though this commit also adds the wrapper
to implementation and private header files.
An alternative to the wrapper would have been the version of
std::equal that takes four iterators. However, that is a C++14
library feature, while this version of Qt still needs to compile
with a C++98 compiler, and, more importantly, there isn't, and
never will be, a corresponding 4-iterator version of std::copy.
Task-number: QTBUG-47948
Done-with: Stephen Kelly <steveire@gmail.com>
Change-Id: I1bbab257fb5f1c5042939c382a412b596112ff26
Reviewed-by: Stephen Kelly <ske@ableton.com>
Change-Id: I97821ffa0c485815c781dc4f98012b0b490da90a
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Coverity, CIDs: 10724, 10725. Data member _iterator is not initialized.
Change-Id: I0c94f5cef031e208aab1687209282fae0317f0ab
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Andre reported issues to me which seem to arise from this patch.
Most notably, he showed me a backtrace containing the following
assertions. Note how the dtor of ConnectionListsRef is
accessing shared data which used to be guarded by the connection
lock, which got broken by my patch that is now reverted hereby.
A future patch can potentially reintroduce my performance
optimization but that will require more evaluation and better
checks with TSan or helgrind. Sorry for this.
Thread 7 (Thread 0x7fffc7fff700 (LWP 32705)):
.0 0x00007ffff55ef267 in raise () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
.1 0x00007ffff55f0eca in abort () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
.2 0x00007ffff62286d7 in qt_message_fatal (context=..., message=...) at
global/qlogging.cpp:1647
No locals.
.3 0x00007ffff622472a in QMessageLogger::fatal (this=0x7fffc7ff8650,
msg=0x7ffff658c9d0 "ASSERT: \"%s\" in file %s, line %d") at global/
qlogging.cpp:792
message = {static null = {<No data fields>}, d = 0x7fffc14f5050}
ap = {{gp_offset = 40, fp_offset = 48, overflow_arg_area =
0x7fffc7ff8630, reg_save_area = 0x7fffc7ff8570}}
.4 0x00007ffff621cf43 in qt_assert (assertion=0x7ffff6657ba8
"connectionLists->inUse >= 0", file=0x7ffff6656fa7 "kernel/qobject.cpp",
line=3646) at global/qglobal.cpp:3036
__PRETTY_FUNCTION__ = "void qt_assert(const char*, const char*,
int)"
.5 0x00007ffff64db388 in
QMetaObject::ConnectionListsRef::~ConnectionListsRef
(this=0x7fffc7ff8710, __in_chrg=<optimized out>) at kernel/qobject.cpp:3646
No locals.
.6 0x00007ffff64dbe71 in QMetaObject::activate (sender=0x9d2110,
signalOffset=3, local_signal_index=1, argv=0x7fffc7ff8850) at kernel/
qobject.cpp:3685
locker = {val = 140737328754040}
connectionLists = {connectionLists = 0xa9c460}
lists = {0xa9c4e8, 0x7ffff64a0ceb
<QMetaObjectPrivate::signalOffset(QMetaObject const*)+89>}
numLists = 1
currentThreadId = 0x7fffc7fff700
signal_index = 4
empty_argv = {0x0}
__PRETTY_FUNCTION__ = "static void
QMetaObject::activate(QObject*, int, int, void**)"
.7 0x00007ffff64db300 in QMetaObject::activate (sender=0x9d2110,
m=0x7fffe2d66a80 <CppTools::CppModelManager::staticMetaObject>,
local_signal_index=1, argv=0x7fffc7ff8850) at kernel/qobject.cpp:3602
No locals.
<snip>
Thread 4 (Thread 0x7fffc77fe700 (LWP 32712)):
.0 <function called from gdb>
No symbol table info available.
.1 0x00007ffff55ef267 in raise () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
.2 0x00007ffff55f0eca in abort () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
.3 0x00007ffff62286d7 in qt_message_fatal (context=..., message=...) at
global/qlogging.cpp:1647
No locals.
.4 0x00007ffff622472a in QMessageLogger::fatal (this=0x7fffc77f7500,
msg=0x7ffff658c9d0 "ASSERT: \"%s\" in file %s, line %d") at global/
qlogging.cpp:792
message = {static null = {<No data fields>}, d = 0x7fffb94f14b0}
ap = {{gp_offset = 40, fp_offset = 48, overflow_arg_area =
0x7fffc77f74e0, reg_save_area = 0x7fffc77f7420}}
.5 0x00007ffff621cf43 in qt_assert (assertion=0x7ffff6657ba8
"connectionLists->inUse >= 0", file=0x7ffff6656fa7 "kernel/qobject.cpp",
line=3646) at global/qglobal.cpp:3036
__PRETTY_FUNCTION__ = "void qt_assert(const char*, const char*,
int)"
.6 0x00007ffff64db388 in
QMetaObject::ConnectionListsRef::~ConnectionListsRef
(this=0x7fffc77f75c0, __in_chrg=<optimized out>) at kernel/qobject.cpp:3646
No locals.
.7 0x00007ffff64dbe71 in QMetaObject::activate (sender=0x9d2110,
signalOffset=3, local_signal_index=1, argv=0x7fffc77f7700) at kernel/
qobject.cpp:3685
locker = {val = 140737328754040}
connectionLists = {connectionLists = 0xa9c460}
lists = {0xa9c4e8, 0x7ffff64a0ceb
<QMetaObjectPrivate::signalOffset(QMetaObject const*)+89>}
numLists = 1
currentThreadId = 0x7fffc77fe700
signal_index = 4
empty_argv = {0x0}
__PRETTY_FUNCTION__ = "static void
QMetaObject::activate(QObject*, int, int, void**)"
.8 0x00007ffff64db300 in QMetaObject::activate (sender=0x9d2110,
m=0x7fffe2d66a80 <CppTools::CppModelManager::staticMetaObject>,
local_signal_index=1, argv=0x7fffc77f7700) at kernel/qobject.cpp:3602
No locals.
.9 0x00007fffe2a7aa0a in CppTools::CppModelManager::documentUpdated
(this=0x9d2110, _t1=...) at .moc/debug-shared/moc_cppmodelmanager.cpp:299
_a = {0x0, 0x7fffc77f7740}
This reverts commit 8619214c5e.
Change-Id: I13df84012e74a01db750a99a8e5e4bf5357c7f78
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Saves reading two lines and allocating storage for them.
Change-Id: I71f6c7019f4c097897945eea52851e4623b75dc2
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
qIsEffectiveTLD() and containsTLDEntry() now
have overloaded versions with QStringRef arg.
Change-Id: Ic2b7fd56c8ea1579d3e4bdf4ed0e10405515d417
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
These types are held in QVarLengthArrays, so benefit
from being trivially relocatable. They are also part
of the private API, so there's no BC issues with
potential uses of these types in QList.
Change-Id: I8adc0c801885f8fffa05eb1f173d7e4bb085ba7b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The rationale is to be consistent with other operating systems, all of which
print a version number following their name (possibly in parenthesis if the
version is typically non-numeric as is always the case with OS X so far and
has been with Windows).
The version number printed here is only two digits, both for consistency with
OS X and because the first two digits of an operating systems's version are
typically the limit in marketing materials and general presentation.
This also fixes a bug where the returned string would be "Windows " (note the
space) in the case where the name of a future Windows version was not known.
[ChangeLog][QtCore][QSysInfo] The output of QSysInfo::prettyProductName
now includes the Windows OS/kernel version number. In case of future versions
of Windows, a valid string is now returned.
Change-Id: I588c2e0aaae19337eb69b4645f8bccf8270c75bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QAtomicPointer is CopyConstructible, but std::atomic<T*> is not,
for a reason. So avoid putting them in a QVarLengthArray, using
a dynamic heap allocation instead. This sounds wasteful until
you realize that virtually all users of QMutexPool (and we know
them all) use the global instance(), and that each QMutex (131,
by default) is heap-allocated, too.
Change-Id: Ie9c95671ec42a1f51919c18631b623aad2c0d6ba
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is relevant if the custom filter passes through some categories to
the previous one (which might be the default one). In this case changes
to the filter rules never took effect.
Change-Id: I1a3ab569857d43621ce5df4e690c6e64e6bc7a66
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
struct BacktraceParams is too big (more than one pointer), so using it
with QList is inefficient. Let's use QVector instead.
Change-Id: Id75834dab9ed466e94c7ffff144572c1eb3fb0e5
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The "path" of a mailto URL isn't a file, so we shouldn't try to do
glob-based matching. I was getting application/x-ms-dos-executable
for a .com domain and application/x-perl for a .pl domain...
Change-Id: Ifc346c3bba83ba1a8476db3202492f4c2e4d52bb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When running a process that requires elevated privileges (such as
regedt32 or an installer), the Win32 API CreateProcess fails
with error ERROR_ELEVATION_REQUIRED.
Fall back to ShellExecuteEx() using the verb "runas" in that case,
bringing up the UAC prompt.
Task-number: QTBUG-7645
Change-Id: Iee82a86a30f78c5a49246d2c0d4566306f3afc71
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Coverity's CID 157687: QCache::insert, indeed, can delete (immediately)
the object we're trying to insert. While this never happens actually in
qlockfile_unix since we have max cost 10 and insert with cost 1, the
code does not look good and Coverity is not happy.
Change-Id: I16a428017bf86e151afe5256906e4cab1ef4044a
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Avoid incurring the cost of converting the latin1 data in that case.
Several existing QString unit tests excercise the new code path.
Task-number: QTBUG-52617
Change-Id: I27256d9e7db34f09543e244a79d754ff7932f0d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The startDetached(const QString &, OpenMode) overload and the
QT_NO_PROCESS_COMBINED_ARGUMENT_START macro must point to the
start(const QString &, OpenMode) overload.
Change-Id: I7607fcb92b9f1ef3547a4a1aadc950532024225a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
They were duplicating other enumeration values
(WindowTransparentForInput, WindowOverridesSystemGestures) and were
only supported on Windows CE.
Task-number: QTBUG-42897
Task-number: QTBUG-51673
Change-Id: I993a933ee2a3dc8a0ebd7ba6aef80b456f50a657
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
QEventDispatcherWin32 on WinCE uses a separate low-priority thread to
monitor sockets activity, so changing the state of notifiers occurs
asynchronously to the main thread. This makes a message-based socket
activation mechanism ineffective.
To avoid timeouts in the helper thread, update the thread's pool
directly from the (un)registerSocketNotifier() functions.
Change-Id: I702c32d69dce09323ca5f65dc2ee1407842e41ef
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
When I tested this, it compiled, but either I wasn't using the same
compiler or the problem happens during linking: we can't use .quad
(64-bit) with a relocation on x32. So instead, let's use .long (32-bit).
Task-number: QTBUG-52658
Change-Id: Ifea6e497f11a461db432ffff14468d1a16f49c67
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
This functionality will get replaced by a new and more flexible system
to configure Qt.
Change-Id: I04cf694ab1671eeed39b79a660566595a22f54a7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
std::shared_ptr supports it. To resolve an ambiguous overload when a
literal 0 is passed as a parameter, the normal constructors needed to be
made a template, like std::shared_ptr.
Task-number: QTBUG-52569
Change-Id: Id75834dab9ed466e94c7ffff14451417892d2148
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... with known size and known value by corresponding ctor.
Don't use appending for this case.
Change-Id: I70f5b943cda7e55eeb45becf439f79c9aee77278
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
For CoW types const methods will be called.
Mark store_persistent_indexes() as const,
because this method does not modify the object.
Change-Id: Ic867913b4fb5aaebfbaaffe1d3be45cf7b646403
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Make sure we always set the base feature as a flag in qtconfig, and
set the sub-feature in addition if it's being used.
Change-Id: Icfeb0ec1ac9e1a615b5b22eb5fcce47e0e7fc153
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This method is called by QString::toLocal8Bit_helper(), so using
QString::toLocal8Bit() on the input in an error message on failure to
decode would be apt to recurse on the same data (if such an error ever
arises). Furthermore, the qWarning()'s format string even claimed
what it was displaying was in UTF-8. Fix by using native fprintf and
UTF-16.
Thanks to Frédéric Marchal for spotting this and checking that such
errors aren't (at present) possible.
Change-Id: I1ad441f2e3700bc01256d6c1718d404e27bce488
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Seems to be the last 5.6 QtBase public header that didn't,
paving the way to add the warning to the headersclean check.
Change-Id: Ib2655782e34ec58e5d9b1b9c0ec31a965a38f9b7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Use the GetVersionEx method on WinCE. The ntdll.dll does not
exist on that platform, therefor a wrong version number was returned.
Change-Id: I7b51757d0fb612dcd8832e0903a93b9d1c6746c0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
When the formatting parameter wasn't exactly QUrl::EncodeUnicode, it
wouldn't encode, despite having to.
Change-Id: Id75834dab9ed466e94c7ffff1444bacc08dd109b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
The RFC does allow it. It even has examples showing them as valid. In
section 6.2.3, it shows:
http://example.comhttp://example.com/http://example.com:/http://example.com:80/
Change-Id: Id75834dab9ed466e94c7ffff1444b7195ad21cab
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Clang 3.8 and Apple Clang 7.x seem to think that the parameter is a
temporary.
See https://llvm.org/bugs/show_bug.cgi?id=26396
Task-number: QTBUG-52134
Change-Id: Id75834dab9ed466e94c7ffff1444b6f2424d7fb7
Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
When automatic reference-counting (ARC) is enabled on Darwin platforms
the NSAutoReleasePool class should not be used directly, which caused a
build error if qglobal.h was included after the Foundation.h in client
code.
The preferred alternative for ARC is the scoped @autoreleasepool
construct, which allows the compiler to reason about needing to
insert _objc_autoreleasePoolPush and _objc_autoreleasePoolPop
calls.
Note that ARC translation units can be combined with non-ARC translation
units, so Qt and the QMacAutoReleasePool class can still be used in
ARC client code even if Qt is not built with ARC.
Task-number: QTBUG-51332
Change-Id: I7ef1c3146aa416a9d6a1dc299ce7b17f22f889e5
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
The behavior was different in the variadic template code and in the C++98
code. The code without variadic template support was not copying the functor
object (e.g. a lambda) before calling it.
However, in the variadic template section, QtPrivate::FunctorCall::call
took the functor by value instead of by reference resulting in a copy.
QtPrivate::FunctorCall::call is a helper function for
QtPrivate::FunctionPointer::call which is only needed for variadic template
expension.
[ChangeLog][QtCore][QObject] If the compiler supports variadic templates,
no longer copy functor connected to a signal each time the signal is
emitted. Restoring the C++98 behavior.
Task-number: QTBUG-52542
Change-Id: I3ca20ef6910893b8a288e70af7de4c7b69502173
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When the system launches the application via different activation mode
(eg. app registered for sharing) no main window will be created. Hence
accessing the core window will return null and event dispatcher
initialization will fail.
In that case iterate through all available views and try to get access
to their dispatcher to be able to invoke code on the xaml thread.
Task-number: QTBUG-49276
Change-Id: I8c78baa27747a0465ff7a1b2ead6c9e03f0e05a8
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Specifically, those that compare UTF-8 octet-streams:
- QByteArray <-> QByteArray
- QByteArray <-> const char*
For more, Qt first needs to gain a nothrow UTF-8 <-> UTF-16
comparator.
Change-Id: Ibccbdcdc3ebed5b1ac0e65c971f6f7d1bd15b6da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
qtbase/src/corelib/global/qnamespace.qdoc:101: warning: Undocumented enum item 'AA_SynthesizeMouseForUnhandledTabletEvents' in Qt::ApplicationAttribute
qtbase/src/corelib/global/qnamespace.qdoc:2554: warning: Undocumented enum item 'ImAnchorRectangle' in Qt::InputMethodQuery
qtbase/src/corelib/statemachine/qsignaltransition.cpp:154: warning: Can't link to 'Q_COMPILER_DELEGATING_CONSTRUCTORS'
qtbase/src/gui/image/qiconloader.cpp:160: warning: Cannot find 'QIconCacheGtkReader' specified with '\class' in any header file
qtbase/src/gui/painting/qpaintengine_raster.cpp:1382: warning: No documentation for 'QRasterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData)'
qtbase/src/testlib/qtest.h:176: warning: No documentation for 'QTest::toString(const QHostAddress &addr)'
qtbase/src/testlib/qtest_gui.h:77: warning: No documentation for 'QTest::toString(const QColor &color)'
Change-Id: If9ac0807accf2530ec7fc2ca7db71a110f9f79bb
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Whenever we notify about ImAnchorPosition, we also need to notify about
ImAnchorRectangle
Change-Id: Ia449396e1b9e91fa0e6f95c323e31533da660171
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
QImage::convertToFormat was ignoring its conversion flag argument, only
performing dithering when converting to indexed formats.
This patch updates the documentation and implements ordered dithering
for other conversions.
Change-Id: I807353d61669694185b7e595ef262d80d9fbb3f1
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Before this change QFile::errorString function was returning an
"Unknown error". Now it will return the typical ENOENT string.
Task-number: QTBUG-45259
Change-Id: Ib7634f1aa5d91f77151cf92c58d3956e20a4cc6b
Reviewed-by: hjk <hjk@theqtcompany.com>
This is not done for other platforms (iOS or Windows) and eliminates a
maintenance burden and potential of inconsistencies with other parts of
the documentation (as illustrated by the fact that this page indicates
the wrong minimum supported version). The Supported Platforms page will
be the authoritative (and only) source of which particular versions of a
given operating system are supported.
Change-Id: I5a31f68965265f2dcd6515b1fa9385a9e9078274
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
QUrl::FormattingOptions need to be declared with Q_DECLARE_FLAGS for documentation
purposes. But it's actually a QUrlTwoFlags and need to be so in order to get
the default arguments parsed without errors.
So hack it by introducing a fake internal QFlags specific to QUrl
Change-Id: I851aca2ab3fd4c10d9cb2dc4d6a0f236813d20ad
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
We need to do the icon cache trick all desktops using indicator-application,
these are not limited to Unity. For example, the default Xubuntu and Lubuntu
desktops use indicator-application too.
Without this, tray icons will be improperly shown on these desktops.
Change-Id: Id397bbe9b594152d7c3a29c36c853e928af7dde4
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
SSE2 can use intrinsics, which are supported by WEC2013, but for WEC7
they need to be defined.
Change-Id: I261f3db4db7abcb0b59598cef9cbad404635c3ec
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Gunnar Roth <gunnar.roth@gmx.net>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
(for instance any global object which writes out to a config file in the
destructor). If the global cache isn't available anymore, don't use it.
Change-Id: I851a6e394d0b073aebf3ffd88b1966d424bfb92e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Manual splitting instead of QStringRef::split()
Change-Id: I27ccf1c4e44ead5b13f85f2cdbd990cb3b874a7a
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
For CoW types const methods will be called.
For QDate we can use new const getDate() method.
Change-Id: Ie3a4fe48b3635d270a79c9ac5205b835b3442eae
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... instead of using removeAt in a loop, with quadratic complexity.
Change-Id: I38b49e56b12c396db9fc0f1b75d8fb43c503a7f6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
It's urgent to fix the issue that on Android, it became impossible
to interact with any widget or MouseArea which handles only mouse
events but not tablet events, using the stylus, because stylus events
are sent only as QTabletEvents. Before 5.6 (change
01d78ba86a) they were sent as
touch events, and mouse events were synthesized from those. Whereas
on other platforms, every QTabletEvent is followed by a synthesized
QMouseEvent.
This fix proceeds in the direction that event synthesis should be done
in cross-platform code so that platform plugins don't have to repeat it,
following the same pattern as for touch->mouse synthesis. Just as
in that case, the application can disable it, and the platform plugin
can also report that it's unnecessary for Qt to do the synthesis
because the platform already does.
So QTBUG-51618 is fixed, but QTBUG-47007 requires us to remove the
tablet->mouse synthesis from all platform plugins, because the plugin
does not know whether the tablet event was accepted or not, so it does
not have enough information to decide whether to synthesize a mouse
event. Synthesis has been unconditional until now, which contradicts
what the documentation says: the mouse event should be sent only if
the tablet event is NOT accepted. We can now gradually make this
promise come true.
[ChangeLog][QtCore][Tablet support] A synthetic mouse event will
no longer be sent after every QTabletEvent, only after those which are
not accepted (as documented).
Task-number: QTBUG-47007
Task-number: QTBUG-51618
Change-Id: I99404e0c2b39bbca4377be6fd48e0c6b20338466
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Documentation was missing for the new toCurrencyString() function that
adds a precision value.
Change-Id: I16c10cdd18dfc37839fccb907470b0942f100e5d
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Add some extra checks to the parser to make sure that addresses
like "300-05" aren't interpreted as valid IPv4 addresses.
Change-Id: I12475eebc9452e060779bb05e2b4ad9512a28281
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Various |s of existing section flags were used repeatedly; naming
these masks makes the relevant code easier to read. In QDateTimeEdit,
add a comment to make clear that its Section enum is based on QDTP's.
Change-Id: Ifd8364cd396a6d0d5ed7ae7dc4d31690f77edd30
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The former has (for now) nothing private, so QLocale got away with
setting its .defaultLocale explicitly; provide a setter method by
which it can do that, to allow scope for later encapsulation.
Change-Id: I77fc5fc8f868fc7cf8d51eb1c5d18926c61cbf78
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
A switch (was inconsistent about whether enum members need casts and)
made it less obvious, rather than more, what was going on; so changed
it to a nested if.
Change-Id: I9af322d9dd17aa08cac5003eff2c8eaa73b50d45
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
It probably wasn't necessary in the first place, but it
certainly isn't needed now. Also changed a pair of internal
qdoc comments on static functions that are not declared
outside the .cpp file. Now they are no longer qdoc comments.
This change does not require clang in qdoc.
Change-Id: I39df3eb1e3f57ba1da93f27892d0c3af8f9481ef
Task-number: QTBUG-52454
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
These uses of Q_QDOC cause clang to report syntax errors.
They are used to hide function return values as qreal
instead of using double and float. The decision is to be
more transparent and use double and float in the docs
instead of qreal.
This change does not require clang in qdoc.
Change-Id: I65b3afb693b1eff486b0b45b8d972fec96953c5f
Task-number: QTBUG-52454
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* A bunch of fixes and additions to the locale data
* Add new scripts from Unicode 8.0 and 9.0
* Map some potentially useful languages and territories
[ChangeLog][QtCore] QLocale data updated to CLDR v29
Change-Id: I759ccb27fe19be2722be913c5c2e6aa5f36e5c14
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.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>
Most containers have them in Qt 5.7, so add them
to QStringRef, too.
Brush up the docs, use the const_iterator typedef
in the API, for consistency with QString's docs.
[ChangeLog][QtCore][QStringRef] Added reverse iterators,
rbegin(), rend(), crbegin(), crend().
Change-Id: I3d2884a1b2faae02c610ab3871552b65bc6e2521
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Their implementations were swapped.
Found while extending tst_qstringapisymmetry, which only exists in
dev, so test will be added to dev once this change has merged up.
[ChangeLog][QtCore][QStringRef] Fixed relational operators against
(const char*) to return the correct result.
Change-Id: I3f331037571b9a543a6885802836b768143d1c1a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Its "rules" are actually guidelines, its suggested regex was wrong,
its actual implementation was fuzzier than its documentation suggested
and the exception it tacitly permitted should be distinguished from
the stricter rules it otherwise appears to implement. There was also
a redundant check ('-' had been handled earlier in the chained if).
Explain why the situation is tricky, fix the regex mentioned (making
it more readable, too) and note what might be worth doing a little
more fussily, without actually changing code behavior.
Change-Id: I93fa0da0640a134e5d84011b435a186576824063
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This might be useful for IDE or other tools to be made aware of Qt macros.
This is inspired to what QtCreator[1] and moc-ng[2] does. But they are forced
to redefine or inject code at precise location which might be difficult.
This is going to make it easier to use libclang in qdoc.
With this change, the tooling can just predefine the macro QT_ANNOTATE_FUNCTION
and QT_ANNOTATE_CLASS to get what they need.
Example with libclang:
"-DQT_ANNOTATE_CLASS(type,...)=static_assert(sizeof(#__VA_ARGS__),#type);"
"-DQT_ANNOTATE_CLASS2(type,a1,a2)=static_assert(sizeof(#a1,#a2),#type);"
"-DQT_ANNOTATE_FUNCTION(a)=__attribute__((annotate(#a)))"
"-DQT_ANNOTATE_ACCESS_SPECIFIER(a)=__attribute__((annotate(#a)))"
"-DQ_CLASSINFO(name,value)=static_assert(sizeof(name,value),\"qt_classinfo\");"
"-DQ_REVISION(v)=__attribute__((annotate(\"qt_revision:\" QT_STRINGIFY2(v))))"
[1] qt-creator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h
[2] https://code.woboq.org/mocng/src/qobjectdefs-injected.h.html
Change-Id: I88fcb28f1dbb3d26ea82f10e9948e68a18c795e9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Adds the following API:
* QInputMethod::anchorRectangle()
* QPlatformInputContext::setSelectionOnFocusObject()
This will be used for determining how to display selection handles.
Change-Id: If57e3fd58ff0f1ba7899f7dd62bfa9c006028667
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
This prevents the call from happening in case no C++ signal is
connected.
Change-Id: I32027df446391f3fc979528738a106223042d632
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Instead of relying on the QString relational operators to
implicitly convert the QChar to a QString, add relational
operator overloads that compare the QChar without first
turning it into a QString, saving one memory allocation
per comparison, and allowing to mark the operation as
nothrow.
Consequently, in tst_QStringBinOps, verify now that all
relational operations are noexcept.
The added overloads make QChar ==/!= int comparisons
ambiguous. De-ambiguate by providing a constrained
template that matches int and nothing but int (otherwise,
the QChar and the int versions would compete for a
QChar::SpecialCharacter argument, and end up creating
new ambiguities). This solution may not be perfect, but
it can be easily extended should more ambiguities crop up.
The existing overload deals with all patterns found in
qtbase.
Change-Id: I4156d918e9b9134c1da684b8b69e0ee526ad24e3
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
For QChar <> QStringRef, equality and inequality were already provided
(via QChar -> QString implicit conversions, to be fixed in a separate
patch). Missing were the less/greater than (or equal) operators.
Added.
For QChar <> QLatin1String, all relational operators were missing.
Added, too.
[ChangeLog][QtCore][QChar] Added missing operator{<,>,<=,>=}
comparing against QLatin1String and QStringRef.
[ChangeLog][QtCore][QChar] Added missing operator{==,!=}
comparing against QLatin1String.
Change-Id: I9941fe7e7281ea560b3bd5970cb9651ffadc1495
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
The format to use was computed, every time round a loop, in both
branches of a ?: choice, duplicating code and potentially computation.
Pull it out into a const computed once before the loop.
A conditional return 2 is pointless for the #if-branch which returns 2
unconditionally, so move it into the #else.
Change-Id: Ia583e958e24f9f37b92cb3f2a173bc07e88bcd06
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... to avoid unnecessary allocations with
both case sensitive and case insensitive paths.
Optimize 4413254ff6
Change-Id: I4288831d641f7a0ee67f2efd2f5d4f023df0d39c
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Found by UBSan:
itemmodels/qabstractitemmodel.h:426:28: runtime error: left shift of negative value -1
Fix by casting the lhs of the left-shift operator to uint
before shifting. Since Qt assumes two's complement repre-
sentation of signed integers, this should yield the same
result as the old code, but without UBs.
It is critically important that the result is identical
to the old code (modulo the compiler exploiting the UB,
which this patch aims to prevent even in future compilers),
because the function is inline, and changing the hash value
would mean changing the layout of a QHash<QModelIndex,.>
between users compiled against the old and new libraries.
Change-Id: I7b826a34fb78b02021e40c3f85fd11af398dbec4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The flags here are passed to a private QVariant constructor, and they
really represent a boolean - IsPointer or not.
Because the flag for the key_type was incorrectly populated with the
flag for the value_type, memory would be corrupted when using a mapping
type whose value_type is a pointer, but whose key type was not, such as
QMap<QString, int*>
This typo has been there since the concept was introduced in commit
v5.2.0-alpha1~807 (Add container access functionality for associative
containers in QVariant., 2013-04-05).
Task-number: QTBUG-52246
Change-Id: I9ecb13c603015eed2dc2ca43947fa0ecd6be8b5a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... by replacing QString::split() with QString::splitRef()
and using the new overloaded functions:
- QLocalePrivate::languageToCode(QStringRef)
- QLocalePrivate::languageToCode(const QChar*, int)
Change-Id: I2884bdc6d3e27963ce121d659a5e092b10b4ef8c
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... for QStringRef and QChar array.
Now we can use QStringRef arg or QChar array arg to avoid
unnecessary allocations.
Also mark these functions as Q_DECL_NOTHROW.
Change-Id: Ibe75346d80cc413e303fad886ecb82dbdb89af24
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Now we can use QStringRef arg or QChar array arg to avoid
unnecessary allocations.
Also mark these functions as Q_DECL_NOTHROW.
Change-Id: I22b08a054051e80e3f76bb543d860f3dcb6caa4f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Bump WINVER, _WIN32_WINNT in qt_windows.h and add a define in corelib.pro
overriding the definition in _mingw.h which would otherwise cause a conflict
in the precompiled header.
Task-number: QTBUG-51673
Change-Id: I1428a74b2f00295afd06a0af7769ebf729daebb9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Program can't continue execution, if QByteArray::resize() fails.
Change-Id: I7138cadada0c1ecdb782daa32ab33b16f22291c6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Cleaning out the workarounds for the discontinued "Embedded Android"
platform of Boot2Qt.
Change-Id: I0ff9d770e82a43457fb7e5da0428f4597ead4038
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This change disables tests which require QtGui.
Change-Id: Ib647afd086f54536054cb4c0cde5696d762ee8c4
Reviewed-by: Stephen Kelly <steveire@gmail.com>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
While compiling with clang, everything has to be valid code. So the types
have to be correct
Change-Id: I73f5e493a19e27b1a459f92ea37480f3329a1c0a
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
One day we might add that information to the documentation itself.
But it is important to declare them as constexpr otherwise this causes
error while parsing code that wants it to be constexpr when generating the
documentation of other constexpr function
Change-Id: I28120fea90b29fe1e87af0d8cded0f2430e35443
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
In functions such as QObject::connect and similar which are using pointer
to member function or functor, we have a different declaration for qdoc
because we don't want to show the QEnableIf and other type traits in the
doc.
However, The code still needs to be valid, as we will use clang to parse
the documentation.
Fix it by making 'PointerToMemberFunction' and 'Functor' template
parameters (which they actually are).
Change-Id: Ie2648407bae21ba6d1677f6de2d6f597486b5c98
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Update files using old header.LGPL3 to header.LGPL
Update files using old FDL template to use new one
Update files using old BSD template to use new one
Change-Id: I36a78272516f9953d02956522f285b40adfc8915
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
The previous implementation overwrote multiple 'time' parts in the
qSetMessagePattern with the last setting in the pattern line.
%{time}%{time process}%{time boot} ended up to be output as if
%{time boot}%{time boot}%{time boot} was set.
This fix keeps the arguments of each individual 'time' part.
The same holds for multiple 'backtrace' parts. The previouse
implementation overwrote multiple 'backtrace' arguments with the
arguments of the last occurrence.
This fix keeps the individual arguments for the 'process' parts.
The individual arguments are applied in qFormatLogMessage.
A new test to verify the individual 'time' arguments application
is added, too.
Task-number: QTBUG-51944
Change-Id: Ib757614a482c5f31ed0a61b550daa2eea4b907b4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Commit 0307c008 removed the buffering of data-to-be-written from
QWindowsPipeWriter, because it was assumed that users of this class
(QProcess and QLocalSocket) already buffer data internally.
This assumption was wrong for QLocalSocket. The following sequence
localSocket->write(someData);
localSocket->write(someMoreData);
would not write anything on the second write.
Add a write buffer to the Windows implementation of QLocalSocket.
Task-number: QTBUG-52073
Change-Id: I6d0f03a722ec48138cbde3e2f69aae7dafe790d3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
While the implementation of the QByteArray::operatorX(const QString &s2)
for X \in { ==, !=, <, <=, >, >=} was already inavailable when
QT_RESTRICTED_CAST_FROM_ASCII was defined, the declaration was
still visible, leading effectively to a linking error.
This change hides the declaration, too, creating a compiler error as
intended, and as present with the QString::operatorX(const QByteArray &s2)
functions.
Change-Id: Ifdb0b85b7423b3b9c69212639b1512b0808a7983
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Clang expects valid expressions. (Code that actually compiles.)
Now this is a valid expression ('or' is a C++ keyword meaning '||').
And it still has the meaning we want to convey in the documentation.
Change-Id: If217e9e448eabe2a64df81cf5cd25f8c17e22109
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
QListSpecialMethod is an internal class. Everything needs to be hidden
from Q_QDOC otherwise while parsing with clang, we get errors.
Importantly, hides it while inheriting from QList so it does not
appear in the documentation
Change-Id: If2ac158f35d6a367aa033cfc7e6a054c912359b9
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
This patch adds a new option, QCommandLineOption::ShortOptionStyle, which helps
applications (such as compilers, so moc and now qdoc) which need to mix long-style
and short flags.
[ChangeLog][QtCore][QCommandLineOption] Added flags() and setFlags() methods.
Added ShortOptionStyle and HiddenFromHelp flags.
Change-Id: I944ce56aff2b28ecd6bb9d2d23c4e726e9d06647
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The spawn code was only used to make QProcess work on QNX 6.5.0. Fork
works on QNX 6.6.0. The QNX spawn implementation has a flaw that causes
a deadlock in certain situations. When a working directory is specified
for the process, the QNX spawn implementation stops all threads except
the one doing the spawn so that it can temporarily change the process'
working directory. This can lead to a deadlock if the thread does
anything that conficts with something being done in a stopped thread.
QNX 6.5.0 is no longer supported in Qt 5.6.0 so we can just switch QNX
to the fork implementation and get rid of the spawn implementation.
Made a QNX specific adjustment to the hardExit test. There's a bug
in the OS that the test can run into because it does something that
normal applications wouldn't.
Task-number: QTBUG-47250
Change-Id: Ib32567d2c15ce651815858000035ac5aa6f35224
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
unix is defined for the integrity target. Remove the general |integrity
and only special-case forkfd.
Change-Id: I8752e62659c28261b2309013fad6e8a82b9397d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The documentation of qSetMessagePattern was missing links to qInfo() and
the category logging siblings: qCDebug, qCInfo, qCWarning, and
qCCritical.
This patch adds the links and adds a link to QLoggingCatergory class.
Task-number: QTBUG-51943
Change-Id: I85c1a205bfcd555cb0516f8cbdd157d8f20185b4
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
This reverts d5fde51410 and makes
that enum value the default for QWheelEvent::phase() with non
phase-aware mice.
[ChangeLog][QtGui] QWheelEvent::phase() returns NoScrollPhase with
non phase-aware mice. This is most mice and input devices except,
for now, Apple's trackpads and Magic Mouse.
Change-Id: I929fb39889cf116e89dcd134c1b1ec6587b8f05e
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Math functions are linked in by default on INTEGRITY.
Change-Id: I737ae87c02b2321caca3975f69525731e839d1a7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Note that while GHS C/C++ is using EDG as a frontend, _BOOL is only
defined when using the C++ driver, and not when building third-party C
code like libpng and friends.
Change-Id: Ife19bd09e4c9f3efea6383c0eede9e0947265ca2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Re-work QWindowsPipeWriter to not use a thread anymore but the
WriteFileEx API, similar to QWindowsPipeReader. This saves us a lot of
thread synchronization code and enables us to directly write data
without yet another buffering layer.
Also, this fixes the dreaded deadlocks in the QWindowsPipeWriter
destructor that could occur when the reading end was closed before
the write was finished.
Task-number: QTBUG-23378
Task-number: QTBUG-38185
Change-Id: If0ae96dcd756f716ddf6fa38016080095bf3bd4e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The use of QWinOverlappedIoNotifier in QWindowsPipeReader restricts us
in the following ways:
- The handle that gets assigned to QWinOverlappedIoNotifier is forever
tied to an I/O completion port.
- Other notification mechanisms like I/O completion routines of
WriteFileEx do not work with such a handle.
- No other QWinOverlappedIoNotifier can be registered for this handle.
To achieve the ultimate goal of making QWindowsPipeWriter thread-free
(to fix QTBUG-23378 and QTBUG-38185) we remove the usage of
QWinOverlappedIoNotifier from QWindowsPipeReader and use the
ReadFileEx API instead.
This has the additional advantage of removing the need for any thread
synchronization, as the I/O completion routine runs in the thread that
ReadFileEx was called on, leading to simpler and faster code.
Change-Id: I05c983e1f1e49d7dd27e3b77a47f87cae9c3f4c6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
CSIDL_APPDATA should be used instead of CSIDL_LOCAL_APPDATA
on Windows CE. Amends 910f719bd1 .
Task-number: QTBUG-50570
Change-Id: I0cc310ef5fe3fbaefae9c84dd9db8cf48ff48499
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Specifically, this is a single-process build.
Change-Id: I1b2cc33641df0ef73f1f26f388c1af3d954ce6e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Ensure the compiler knows the definition of
QString::compare(QStringRef, Qt::CaseSensitivity) from where it is
referenced. Fixes MinGW errors:
qstring.h:1597:12: error: 'int QString::compare(const QStringRef&, Qt::CaseSensitivity) const' redeclared without dllimport attribute after being referenced with dll linkage [-Werror]
inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW
Amends change 8005fa3524.
Change-Id: I3bb31a79305d338c0abdfdcb365e281443b4546e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Revisions under 7 of moc output are not supported, so there is no point
in having comments about them.
Change-Id: I31ab1d50750f1c1ddc4b804c333eb3ca96d0b93e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Previously WinRT was using the UTC backend which fails on all platforms
for some QDateTime autotests related to timezone items. Hence switch to
the Windows implementation for WinRT as well.
However, the windows backend does query the registry heavily, which is
not supported on WinRT. Instead use the API version provided by the SDK.
Long-term we might want to switch to this version on desktop windows as
well, as direct registry access would not be required and we could
harmonize the codepaths for both platforms.
Change-Id: I620b614e9994aa77b531e5c34c9be1da7e272a30
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
If only one timer is processed in there it is possible that a reoccuring
timer which has a very low timeout blocks all the other timers from
being triggered. This high frequency timer might be the only one to
be triggered in every processEvents call.
Task-number: QTBUG-51888
Change-Id: I8a0026d1e8519171ab60d1b47c494a15d30328b3
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Equality and inequality were already provided. Missing were the
less/greater than (or equal) operators.
Added.
Moved existing functions around and more similar to the new ones,
to make the whole code section a bit more manageable.
[ChangeLog][QtCore][QStringRef] Added missing operator{<,>,<=,>=}
comparing against QLatin1String and QString.
Change-Id: Idb3c4fa9b38421637987226f3cc1b77f5d4a6309
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Try to prevent the data from being copied, if we have a chunk with the
same size in the read buffer.
Task-number: QTBUG-19169
Change-Id: I2a9a5c88855988888b56d0ca69ec4e50b8e6ef98
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
There is no apparent reason why the handle should be duplicated.
Change-Id: I8ff2cde2f050934ed0dd9ab2d39a1b1efa327a17
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Simplify the handling in the pro files as well. system-zlib
is the only option deciding whether we use our bundled copy
or the system lib.
Change-Id: Id28c1c64c5944e86f0e9cd3533268f43e98522a1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This is analogous to QObject::inherits() but only requires the
metaobjects rather than pointers to a QObject instances. This is needed
for type checking on the backend of Qt 3D where we do not have access
to QObject pointers.
Change-Id: I14d26c4cbb5cc3fbecb57725f2c14ee0ffda4a11
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
QRect::center() should be defined for any
QRect(x1,y1,x2,x2), INT_MIN <= x1, x2, y1, y2 <= INT_MAX
because the average of two signed integers is always
representable as a signed integer.
But not when it's calculated as (x1+x2)/2, since that
expression overflows when x1 > INT_MAX - x2.
Instead of playing games with Hacker's Delight-style
expressions, or use Google's patented algorithm, which
requires two divisions, take advantage of the fact that
int is not intmax_t and perform the calculation in the
qint64 domain. The cast back to int is always well-
defined since, as mentioned, the result is always
representable in an int.
Fix a test-case that expected a nonsensical result due
to overflow.
[ChangeLog][QtCore][QRect] Fixed integer overflow in
center(). This fixes the result for some corner-cases
like a 1x1 rectangle at (INT_MIN, INT_MIN), for which
the previous implementation could return anything
(due to invoking undefined behavior), but commonly
returned (0, 0).
Change-Id: I1a885ca6dff770327dd31655c3eb473fcfeb8878
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Saves ~250b in text size on optimized GCC 5.3 Linux AMD64 builds.
Change-Id: Ic92c4ac1bb20230cfbb929bdf5c7f385d7b604e5
Reviewed-by: David Faure <david.faure@kdab.com>
... when more than a return would be executed, to
prompt the compiler to move it out of the way of
the normal execution path.
Unexpectedly costs ~200b in text size on optimized
GCC 5.3 Linux AMD64 builds.
Change-Id: I0ebfb56af7c2262f64271a1b0ec46533e6000bc9
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This change partially reverts 1bfc7f68 about QT_HAS_BUILTIN define
and undef in src/corelib/tools/qsimd_p.h.
This change is also squashed with "Fall back to c++11 standard
compiler flag for host builds" which is done by Peter Seiderer.
Conflicts:
mkspecs/features/default_post.prf
src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch
src/3rdparty/sqlite/sqlite3.c
src/corelib/tools/qsimd_p.h
src/gui/kernel/qevent.cpp
src/gui/kernel/qwindowsysteminterface.cpp
src/gui/kernel/qwindowsysteminterface_p.h
src/plugins/bearer/blackberry/blackberry.pro
src/plugins/platforms/cocoa/qcocoasystemsettings.mm
src/plugins/platformthemes/gtk2/gtk2.pro
src/plugins/styles/bb10style/bb10style.pro
src/sql/drivers/sqlite2/qsql_sqlite2.cpp
tools/configure/configureapp.cpp
Task-number: QTBUG-51644
Done-with: Peter Seiderer <ps.report@gmx.net>
Change-Id: I6100d6ace31b2e8d41a95f0b5d5ebf8f1fd88b44
Introduce template helper function qSelectionIndexes().
Template argument is container. Now we have the same code for
QVector and QList.
Also it's needed for a follow-up change in this file:
add method QModelIndex QItemSelection::index().
Change-Id: I7f86a9b96e5feac9873cf0df7a1cbca74f9191ec
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
QReadWriteLock is supposed to be a better alternative to QMutex when there
are only a few writers but potentially lots of reads. However, in practice
the previous implementation was much slower, unless you really do a lot of
work with the lock for read and you have lots of contention.
Indeed, the previous implementation was locking a QMutex both for lock, and
unlock (making it already at least twice as slow as QMutex).
This new implementation brings QReadWriteLock back to the same level as QMutex:
- No memory allocations in the uncontended case (almost no overhead allowing to
create many of them in classes)
- Lock-free if there is no contention
Should support up to 2^31 concurrent readers on 64 bit platforms, and 2^28
on 32 bit platforms
Change-Id: Ifa2fc999075cbb971088f4ee8e6fde78ce262da3
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
The printf-style version of QDebug expands to a lot less code than the
std::ostream-style version. Of course, you pay in type safety (but
compilers warn about it these days), you cannot stream complex Qt
types and streaming QStrings is awkward, but in many cases you
actually improve on readability.
But the main reason is that something that's not supposed to be
executed under normal operation has no business bloating executable
code size.
This is not an attempt at converting all qWarnings() to printf-style,
only the low-hanging fruit.
In this first part, replace
qWarning() << ""
with
qWarning("...").
Saves ~750b in text size on optimized GCC 5.3 AMD64 builds.
Change-Id: I8bf3e46cd5a6b2cae0ceb3e355a50f61925c63d3
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
No longer try to load all files in the directory as a plugin
which can cause problems when for example installers move
files around.
[ChangeLog][QtCore][QFactoryLoader][Windows] QFactoryLoader now
filters potential plugins by the ".dll" suffix.
Task-number: QTBUG-31476
Change-Id: Ia19d6211c72765aaba0a5d06e6d3b501e8a40fff
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Sometimes, in the .cpp, the declaration has the argument name in comments
because it is not used (instead of using Q_UNUSED). The old qdoc could
parse that, but once clang is used, these comments are not seen anymore.
So add the argument names to the headers. This is also good for things
like auto completion, which uses only the header to know what the
argument name is.
I grepped for " */)" and made sure all the functions that are documented
have the right arguments. I also added the name to all the function around
for consistency.
Change-Id: I1aaa37e25a1985f7f51653f047a1ac2633242b56
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Found by UBSan:
qmimemagicrule.cpp:166:53: runtime error: load of misaligned address 0x00000124bcb9 for type 'const short unsigned int', which requires 2 byte alignment
qmimemagicrule.cpp:166:53: runtime error: load of misaligned address 0x00000124bcb9 for type 'const unsigned int', which requires 4 byte alignment
Fix by using new qUnalignedLoad<T>() instead of a
load through a type-punned pointer and misaligned
pointer.
Change-Id: I6b876f1ce7e01369fbb25a51263d1ad04be07d52
Reviewed-by: David Faure <david.faure@kdab.com>
Found by UBSan:
qjsonparser.cpp:741:30: runtime error: store to misaligned address 0x0000019b1e94 for type 'quint64', which requires 8 byte alignment
Fix by using the qToLittleEndian() overload that can
store to misaligned memory.
Change-Id: Ib84bd30b13c68f7fdb8870c9fbbfac15cff0112d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This warning is triggered when we try to apply the Q_DECL_HIDDEN
attribute to a class in an unnamed namespace. Such classes are
already not exported.
qobjectdefs.h:175:108: warning: ‘visibility’ attribute ignored [-Wattributes]
qobjectdefs.h:198:108: warning: ‘visibility’ attribute ignored [-Wattributes]
Added a test on gadgets (and QObjects) in unnamed namespaces,
because qtbase currently does not contain such Q_GADGETs.
Done-with: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Ic747cc2ab45e4dc6bb70ffff1438c747b05c5672
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Previously, the macro Q_OS_WIN64 was checked, causing warnings:
tools\qstring.cpp(6183): warning C4311: 'reinterpret_cast': pointer truncation from 'void *' to 'unsigned long'
tools\qstring.cpp(6183): warning C4302: 'reinterpret_cast': truncation from 'void *' to 'unsigned long'
when compiling WinRT/64bit, where it is not defined.
Change-Id: Ib9d8405108c85170aba18b13f9c64083136bc5ee
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Found by UBSan:
src/corelib/tools/qstring.cpp:587:42: runtime error: load of misaligned address 0x2acbf4b7551b for type 'const long long int', which requires 8 byte alignment
src/corelib/json/qjson_p.h:405:30: runtime error: store to misaligned address 0x0000019b1e52 for type 'quint64', which requires 8 byte alignment
src/corelib/tools/qhash.cpp:116:27: runtime error: load of misaligned address 0x2b8f9ce80e85 for type 'const qlonglong', which requires 8 byte alignment
src/corelib/tools/qhash.cpp:133:26: runtime error: load of misaligned address 0x2b8f9ce80e8d for type 'const ushort', which requires 2 byte alignment
Fix by memcpy()ing into a local variable. Wrap this trick in
template functions in qsimd_p.h. These are marked as always-
inline and use __builtin_memcpy() where available in an
attempt to avoid the memcpy() function call overhead in debug
builds.
While this looks prohibitively expensive, from the pov of the
C++ abstract machine, it is 100% equivalent, except for the
absence of undefined behavior. In one case, the cast produces
a local temporary which is then copied into the function, and
in the other case, that local variable comes from return value
of qUnalignedLoad().
Consequently, GCC compiles these two versions into identical
assembler code (only verfied for ucstrncmp, but there's no
reason to believe that it wouldn't hold for the other cases,
too).
Task-number: QTBUG-51651
Change-Id: Ia50d4a1d7580b6f803e0895c9f3d89c7da37840c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
... with STL-style iterators or with algorithms.
Java-style iterators have overhead.
Change-Id: Ibeace7357c205a39dff3ca3fc0c835a026a15cac
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
As reported by ubsan:
src/gui/kernel/qplatformintegration.cpp:463:10: runtime error: downcast of address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication'
0x7ffdc2942490: note: object is of type 'QCoreApplication'
src/gui/kernel/qplatformintegration.cpp:466:14: runtime error: downcast of address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication'
0x7ffdc2942490: note: object is of type 'QCoreApplication'
src/gui/kernel/qplatformintegration.cpp:466:43: runtime error: member call on address 0x7ffdc2942490 which does not point to an object of type 'QGuiApplication'
0x7ffdc2942490: note: object is of type 'QCoreApplication'
to name just a few which are reported when running gui and widget
auto-tests; there're definitely more where these came from.
This is caused by QCoreApplication::init() being called from the
QCoreApplication ctor, calling virtual functions on Q*AppPrivate,
which happen to attempt, in this case, to emit QGuiApp signals.
At that point in time, the QGuiApplication ctor has not entered
the constructor body, ergo the object is still a QCoreApplication,
and calling the signal, as a member function on the derived class,
invokes UB.
Fix by cleaning up the wild mix of initialization functions used in
this hierarchy. The cleanup restores the
1. Q*ApplicationPrivate::Q*ApplicationPrivate()
2. Q*ApplicationPrivate::init(), calling each base class'
init() as the first thing
two-stage construction pattern commonly used elsewhere in Qt to make
sure that the public class' object is fully constructed by the time
each level's Private::init() is called.
Change-Id: I290402b3232315d7ed687c97e740bfbdbd3ecd1a
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
To quote http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160222/151168.html :
> AArch64: fix Cyclone CPU features list.
> It turns out we don't have CRC after all. Who knew?
So clang did define __ARM_FEATURE_CRC32, while the CPU didn't support
the crc32 instructions, resulting in EXC_BAD_INSTRUCTION.
Change-Id: I4b0123ac5e7fd04696c05bfe7dacce205cffac8f
Task-number: QTBUG-51168
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
ARMv8 defines the crc32 instructions as optional features. Even though
the target might be ARMv8, the compiler might have been told that the
target CPU doesn't support it, in which case __ARM_FEATURE_CRC32 is not
defined. Subsequently, the arm_acle.h header might only define the
intrinsics when __ARM_FEATURE_CRC32 is defined.
Change-Id: I85efcf9efdd2e152e3f3e72310122eebf543ca3b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
An empty read or a failed write on the underlying QIODevice of the text
stream would lead to an early return where we wouldn't correctly restore
the QIODevice::Text flag of the io device.
Change-Id: I5b632f45dea6ede3f408113556c3dad1b96574e2
Task-number: QTBUG-47176
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Define WINVER, _WIN32_WINNT as 0x501 (Windows XP) in qt_windows.h.
Remove definitions of the same/lower versions and unneeded
definitions in other places. Remove definition for Borland compiler.
Task-number: QTBUG-51673
Change-Id: I2a344a7f7cf78b2afbf45dcdf8bf2a19b93f0a07
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Found by UBSan:
src/testlib/qtestspontaneevent.h:95:38: runtime error: member call on address 0x7ffc33019650 which does not point to an object of type 'QSpontaneKeyEvent' 0x7ffc33019650: note: object is of type 'QMouseEvent'
83 2b 00 00 98 e8 fa 8e 83 2b 00 00 00 00 00 00 00 00 00 00 02 00 04 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QMouseEvent'
src/testlib/qtestspontaneevent.h:95:38: runtime error: member call on address 0x7ffc330196e0 which does not point to an object of type 'QSpontaneKeyEvent' 0x7ffc330196e0: note: object is of type 'QKeyEvent'
00 00 00 00 f8 e8 fa 8e 83 2b 00 00 00 00 00 00 00 00 00 00 07 00 04 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'QKeyEvent'
Fix by providing setSpontaneous() on QEvent as a private function and
befriending QSpontaneKeyEvent. Make setSpontaneous() always-inline to
avoid BiC between 5.6.0 and 5.6.1.
Change-Id: Ic60d82ed6a858f4f13f41fa3d2d1db6e808896b7
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
With the introduction of QtInfoMsg in commit ef6279fd we also changed
the mapping of Qt to slog2 levels: QtInfoMsg now ends up as SLOG2_DEBUG1,
instead of SLOG2_INFO. Anyhow, we didn't change the default buffer
verbosity level accordingly.
Task-number: QTBUG-51378
Change-Id: Ia464f9e5a31e19413902e877d4f2be0ba6d340db
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Janne Koskinen <janne.p.koskinen@theqtcompany.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
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>
This reverts commit 40cbf1927b -
the qmake parser bug this worked around has been fixed.
As a side effect, the platform conditionals were simplified.
Change-Id: Ibfc1253e3c2252ab954c725a9effd6e719cb691c
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
QUtf8::convertToUnicode() contains a SIMD-enabled
ASCII fast-path already which is likely faster
than what the compiler will emit for the old code
here.
Change-Id: I6afae9689424eb53a9f7c01359cc4f57ffcead26
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
iOS cannot do runtime feature detection, and querying the CPU is only
allowed in kernel mode (or beyond), so we have to decide the features
at compile time, in which case we might as well use the fallback code
path that uses the built in __ARM_* macros to point out which features
are supported, instead of hard-coding the features for iOS.
Change-Id: Ie507c0d8e962a7bdab16508c8b8122645276512e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Not all Windows compilers (e.g. MinGW 4.9.2) have WINAPI_FAMILY_PC_APP
defined in their headers and report build failures in several
Qt modules including QtActiveQt. This is fixed by defining the needed
values before they are used.
Task-number: QTBUG-49971
Change-Id: Ib7bac1fe07eb76c64d66fa152427918ee39a2eef
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
QT_MOC_COMPAT has the unfortunate behavior that it generates a warning
at runtime, which also cannot be disabled. This is too draconic.
Task-number: QTBUG-51517
Change-Id: I80af8b8b482671e4c9567281c3b1c504d737e202
Reviewed-by: hjk <hjk@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The code is restructured to only loop over the non-empty connection
lists. This can be checked early while the mutex is locked already,
thus removing mutex lock/unlock calls that were done previously just
to realize the allsignals list is empty and can be skipped.
Additionally, at the very end of the loop over the last signal
connection list, the mutex was acquired even though it doesn't need
to be as we will quit the loop anyways.
This patch leverages these facts to remove the mutex locks which alone
has a considerable impact on the corresponding signal/slot benchmark.
The instruction count goes down by ca. 13%, while cycle count and
runtime drop by about 29%.
Before:
********* Start testing of QObjectBenchmark *********
Config: Using QtTest library 5.7.0, Qt 5.7.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.0)
PASS : QObjectBenchmark::initTestCase()
PASS : QObjectBenchmark::signal_slot_benchmark(simple function)
RESULT : QObjectBenchmark::signal_slot_benchmark():"simple function":
0.00000362 msecs per iteration (total: 362, iterations: 100000000)
14.05652884 CPU cycles per iteration (total: 1,405,652,884, iterations: 100000000)
21.00585673 instructions per iteration (total: 2,100,585,673, iterations: 100000000)
PASS : QObjectBenchmark::signal_slot_benchmark(single signal/slot)
RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/slot":
0.00004709 msecs per iteration (total: 4,709, iterations: 100000000)
183.75943370 CPU cycles per iteration (total: 18,375,943,371, iterations: 100000000)
362.08604759 instructions per iteration (total: 36,208,604,760, iterations: 100000000)
PASS : QObjectBenchmark::signal_slot_benchmark(multi signal/slot)
RESULT : QObjectBenchmark::signal_slot_benchmark():"multi signal/slot":
0.00004965 msecs per iteration (total: 4,965, iterations: 100000000)
183.54556242 CPU cycles per iteration (total: 18,354,556,243, iterations: 100000000)
362.07734835 instructions per iteration (total: 36,207,734,835, iterations: 100000000)
PASS : QObjectBenchmark::signal_slot_benchmark(unconnected signal)
RESULT : QObjectBenchmark::signal_slot_benchmark():"unconnected signal":
0.00000752 msecs per iteration (total: 752, iterations: 100000000)
30.08781366 CPU cycles per iteration (total: 3,008,781,367, iterations: 100000000)
92.01520465 instructions per iteration (total: 9,201,520,466, iterations: 100000000)
PASS : QObjectBenchmark::signal_slot_benchmark(single signal/ptr)
RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/ptr":
0.00005620 msecs per iteration (total: 5,620, iterations: 100000000)
219.24739264 CPU cycles per iteration (total: 21,924,739,265, iterations: 100000000)
327.08675555 instructions per iteration (total: 32,708,675,556, iterations: 100000000)
PASS : QObjectBenchmark::signal_slot_benchmark(functor)
RESULT : QObjectBenchmark::signal_slot_benchmark():"functor":
0.00005852 msecs per iteration (total: 5,852, iterations: 100000000)
218.45401359 CPU cycles per iteration (total: 21,845,401,360, iterations: 100000000)
328.08472410 instructions per iteration (total: 32,808,472,410, iterations: 100000000)
PASS : QObjectBenchmark::cleanupTestCase()
Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted, 44469ms
********* Finished testing of QObjectBenchmark *********
After:
********* Start testing of QObjectBenchmark *********
Config: Using QtTest library 5.7.0, Qt 5.7.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.0)
PASS : QObjectBenchmark::initTestCase()
PASS : QObjectBenchmark::signal_slot_benchmark(simple function)
RESULT : QObjectBenchmark::signal_slot_benchmark():"simple function":
0.00000361 msecs per iteration (total: 361, iterations: 100000000)
14.01854817 CPU cycles per iteration (total: 1,401,854,818, iterations: 100000000)
21.00532932 instructions per iteration (total: 2,100,532,933, iterations: 100000000)
PASS : QObjectBenchmark::signal_slot_benchmark(single signal/slot)
RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/slot":
0.00003398 msecs per iteration (total: 3,398, iterations: 100000000)
132.52735104 CPU cycles per iteration (total: 13,252,735,104, iterations: 100000000)
314.04965106 instructions per iteration (total: 31,404,965,107, iterations: 100000000)
PASS : QObjectBenchmark::signal_slot_benchmark(multi signal/slot)
RESULT : QObjectBenchmark::signal_slot_benchmark():"multi signal/slot":
0.00003448 msecs per iteration (total: 3,448, iterations: 100000000)
133.63623046 CPU cycles per iteration (total: 13,363,623,046, iterations: 100000000)
314.04952237 instructions per iteration (total: 31,404,952,238, iterations: 100000000)
PASS : QObjectBenchmark::signal_slot_benchmark(unconnected signal)
RESULT : QObjectBenchmark::signal_slot_benchmark():"unconnected signal":
0.00000747 msecs per iteration (total: 747, iterations: 100000000)
29.02349389 CPU cycles per iteration (total: 2,902,349,390, iterations: 100000000)
92.01088221 instructions per iteration (total: 9,201,088,222, iterations: 100000000)
PASS : QObjectBenchmark::signal_slot_benchmark(single signal/ptr)
RESULT : QObjectBenchmark::signal_slot_benchmark():"single signal/ptr":
0.00004350 msecs per iteration (total: 4,350, iterations: 100000000)
167.83581885 CPU cycles per iteration (total: 16,783,581,885, iterations: 100000000)
279.06426656 instructions per iteration (total: 27,906,426,657, iterations: 100000000)
PASS : QObjectBenchmark::signal_slot_benchmark(functor)
RESULT : QObjectBenchmark::signal_slot_benchmark():"functor":
0.00004337 msecs per iteration (total: 4,337, iterations: 100000000)
170.45074743 CPU cycles per iteration (total: 17,045,074,743, iterations: 100000000)
280.06267229 instructions per iteration (total: 28,006,267,229, iterations: 100000000)
PASS : QObjectBenchmark::cleanupTestCase()
Totals: 8 passed, 0 failed, 0 skipped, 0 blacklisted, 33228ms
********* Finished testing of QObjectBenchmark *********
Change-Id: I6f79fd68ae7a07d9b439ca047bf1f53c83751d45
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Use new QUtf8::convertToUnicode(QChar*, const char*, int)
overload instead of QString::fromUtf8(). The QUtf8 overload
allocates no memory, and is therefore marked as nothrow.
Using this function in convertFromAscii() allows to mark
this function nothrow, too.
All functions of QAbstractConcatenable can now be marked as
nothrow.
Since QUtf8::convertToUnicode() does not deal with lengths
of -1, insert a strlen() call when the len == -1 ASCII fast
path fails due to non-ASCII chars.
Saves 1.1KiB in text size on optimized GCC 5.3 Linux AMD64
builds of QtCore (other libraries are compiled without
exceptions, so this change should not have an effect on
those).
Change-Id: I7333e35844033831eae2a04203d13d9792c5d460
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
RFC 2045 mandates case-insensitive comparison for MIME type and subtype.
Fixes numerous warnings appearing when dumping the database on
Ubuntu 14.04.1 LTS:
Got name "application/vnd.ms-excel.sheet.binary.macroenabled.12" in file "application/vnd.ms-excel.sheet.binary.macroEnabled.12.xml" expected "application/vnd.ms-excel.sheet.binary.macroEnabled.12"
Got name "application/vnd.ms-excel.sheet.macroenabled.12" in file "application/vnd.ms-excel.sheet.macroEnabled.12.xml" expected "application/vnd.ms-excel.sheet.macroEnabled.12"
Got name "application/vnd.ms-excel.template.macroenabled.12" in file "application/vnd.ms-excel.template.macroEnabled.12.xml" expected "application/vnd.ms-excel.template.macroEnabled.12"
Got name "application/vnd.ms-powerpoint.presentation.macroenabled.12" in file "application/vnd.ms-powerpoint.presentation.macroEnabled.12.xml" expected "application/vnd.ms-powerpoint.presentation.macroEnabled.12"
Got name "application/vnd.ms-powerpoint.template.macroenabled.12" in file "application/vnd.ms-powerpoint.template.macroEnabled.12.xml" expected "application/vnd.ms-powerpoint.template.macroEnabled.12"
Got name "application/vnd.ms-word.document.macroenabled.12" in file "application/vnd.ms-word.document.macroEnabled.12.xml" expected "application/vnd.ms-word.document.macroEnabled.12"
Got name "application/vnd.ms-word.template.macroenabled.12" in file "application/vnd.ms-word.template.macroEnabled.12.xml" expected "application/vnd.ms-word.template.macroEnabled.12"
Change-Id: Ie2a427069024080302a95ac46a456288787542c4
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: David Faure <david.faure@kdab.com>
When reading from the registry, sometimes the string is not null
terminated. In order to fix this, the preallocated QByteArray size
is increased, so that there are guaranteed enough terminating \0
[Windows] Not null terminated strings are now read properly from the
registry
Change-Id: I95fdf42cbbb7074fcf010dd14d0241f02d3c412b
Task-number: QTBUG-51382
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Change-Id: Ifcad547caf2d2a7ad7aa1ccb4fbed08810905cee
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Inherit the type-classification from the underlying type.
This amends commit 4889269ff0,
which introduced a QVector<QJsonPrivate::offset>, but failed
to mark the payload as primitive.
Change-Id: I525a0456a550e0694b33b36b4aa71475aeac192b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Suppose the user connects QProcess::readyReadStandardOutput with a
slot that calls QCoreApplication::processEvents.
Assume the event loop did not handle events between QProcess::start
and QProcess::waitForFinished. The process writes to stdout and exits.
QProcessPrivate::waitForFinished calls drainOutputPipes which calls
QWindowsPipeWriter::waitForReadyRead. This in turn will trigger
_q_processDied via the readyRead signal and processEvents.
_q_processDied will delete the pid object and set pid to null.
After drainOutputPipes returns, _q_processDied is called again but it
must not be called if pid is already destroyed.
Prevent calling _q_processDied if pid is null.
Task-number: QTBUG-48697
Change-Id: Iee047938ee1529057a1a43d71f4e882750903c7e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This issue is reproducible on OS X when using a Magic Mouse
or a combination of Magic Trackpad and regular mouse. In these
cases it's possible to start a scrolling gesture on one widget
and move the mouse cursor over another widget.
Although we send the wheel event phase information, we never
made any use of it. This means that a widget would start
scrolling even though it never received a ScrollBegin event.
In this patch, we make sure the scrolling cycle is respected
and that once a widget starts scrolling, it'll be recieving
all the wheel events until a ScrollEnd event reaches the
application.
For those input devices not supporting a proper phase cycle,
we introduce a new (undocumented) phase value, NoScrollPhase.
If the wheel event phase is NoScrollPhase, then we ignore
the current scroll widget and proceed as usual. This value
is the default for wheel events. It's up to the platform
plugin to set the proper phase value according to the data
received from the OS.
Finally, we fix a few of QWheelEvent constructors to properly
initialize the phase and source properties.
Task-number: QTBUG-50199
Change-Id: I3773729a9c757e2d2fcc5100dcd79f0ed26cb808
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
This is what std::vector implementations usually do,
because it minimizes memory fragmentation and useless
allocations since no user will call clear() unless
she intends to append new data afterwards.
Fix calls to resize(0) that show how existing code
tried to work around the issue.
Adjust test. Port from QVERIFY(==) to QCOMPARE as a
drive-by.
[ChangeLog][QtCore][QVector] clear() now preserves
capacity. To shed capacity, call squeeze() or swap
with a default-constructed QVector object, see the
documentation for an example.
Change-Id: I9cebe611a97e027a89e821e64408a4741b31f1f6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... wherever it allocates memory.
Since the string literal is used in more than one function, to
avoid duplication of .rodata, wrap the QStringLiteral in an
inline function.
Change-Id: If4fca7443b3150b1c8360c850da32f5c567c1065
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The source argument can be nullptr, e.g. if debug information
has been stripped out.
Task-number: QTBUG-51195
Change-Id: Ie229c82278c420200cad33c19e8c3f52ab7f12c3
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The default value of QLibraryInfo::PluginsPath is $prefix/plugins,
where $prefix is the path to the bundle's contents directory
(for example, .../foo.app/Contents/ on OS X, or .../foo.app/ on iOS).
On Apple platforms the directory is actually called "PlugIns".
Plugins could previously be loaded on OS X by coincidence, but
if the system is using an HFS+ Case Sensitive filesystem (and this
is ALWAYS the case on iOS-like operating systems), the case
mismatch would cause plugins in an application bundle not to be
found/loaded.
This change allows plugins to be located in application bundles
on Apple platforms regardless of the HFS+ case sensitivity mode
and without needing to specify a qt.conf file.
Change-Id: Ie0a0f7448fbf5fb410aa77944ba0d01895bb05e3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
It's very useful for bootstrapped tools to be able to include resources.
Those can now be accessed through the QResource API.
Change-Id: Ie8247877a9a4a81cec006bab2b58331270487aef
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
It makes little sense to use QStringLiteral for strings which are
immediately appended to, or which are appended to other strings,
because no dynamic memory allocation is saved by doing so. But if
the only advantage of QStringLiteral does not apply, all its
disadvantages dominate, to wit: injection of calls to qstring dtor,
non-sharability of data between C strings and QStringLiterals and
among QStringLiterals, and doubled storage requirements.
Fix by replacing QStringLiteral with QLatin1String.
Saves 1156B in text size on stripped optimized Linux AMD64 GCC 4.9
builds.
Change-Id: If805e431f570ec1d2ac62c548f516f1b17390c3a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
There is no need to show the splash image immediately when the
application starts, because it will be removed shortly in
QtActivityDelegate.java, therefore show the splash in
QtActivityDelegate.java.
This patch also adds a new option to AndroidManifest.xml which keeps
the splash screen visible until user to decides to hide it,
by using the QtAndroid::hideSplashScreen() function.
Change-Id: I8a29a5a757d626c4c9d6a2748a60ca3091ebf82d
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
The variable being a QVector, this means replacing
default construction followed by one move-assignment
per loop iteration with a StartElement state with
RVO-catching a return value.
Saves ~320b in text size on optimized GCC 5.3 Linux
AMD64 builds.
Change-Id: I618d31ad0816f9ad1a89a6b2e39481258f1e0878
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The function createMagicMatchRule() returned a heap-allocated
QMimeMagicRule, and the caller code did not check the return
value for nullptr, but copied the rule into a container before
deleting the original again.
Fix by returning by-value instead. Every C++ compiler will
use RVO for this. On top, add an optimistic std::move()
when inserting the rule into the container (currently QList,
so no rvalue-push_back, yet).
While touching the return value, also remove an unholy
out-parameter with just local effects by returning a Result
struct instead. The rest of the code remains full of out-
parameters, of course.
Add one Q_UNLIKELY and two qUtf16Printable() as drive-bys.
Saves ~300b in text size on optimized GCC 5.3 Linux AMD64
builds.
Change-Id: I4374ab41f38502cd5c64ac37d106ca4bc6e00327
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Replace QString::arg() with QStringBuilder, use QStringLiteral
where appropriate, and remove it where it isn't (e.g. in
QStringBuilder expressions).
Saves ~750b in text size on optimized GCC 5.3 Linux AMD64 builds.
Change-Id: I2471c849db79f477677213f9a155053248800590
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Keep the return values of QXmlStream*::value() around as QStringRefs
for as long as possible. Avoids conversions to QString, among other
things, for:
- comparison to another string
- conversion to int
- conversion to UTF-8 or Latin-1 byte arrays
Add a pair of Q_UNLIKELY as a drive-by.
Saves ~900b in text size on optimized GCC 5.3 Linux AMD64 builds.
Change-Id: I17d440a11aeb8675979483f89e66d0a088ccc605
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QRingBuffer already works fine with empty list of arrays.
Change-Id: I5cd388709686d2980efa3d5129c726e75c0b5c09
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: I075932cfb9fdd38fb8d54da19e7d72b8cdec49f3
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>