Commit Graph

27619 Commits

Author SHA1 Message Date
Marc Mutz
134cad32d7 QtCore: use printf-style qWarning/qDebug where possible (I)
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>
2016-03-11 10:56:15 +00:00
Aram So
a7fc1cef91 Add environment variable QT_DISTANCEFIELD
DistanceField technique was not intended for rendering very large glyph.
In some case need the qEnvironmentVariable.

Change-Id: Ied11ed00f0c67bae3c92155e17721d8d2f224cca
Task-number: QTBUG-51714
Reviewed-by: Aram So <aram.so@lge.com>
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
2016-03-11 10:44:19 +00:00
Maurice Kalinowski
1929e48bba winrt: Fix painting glitches when orientation changes
In addition to handling the pure rotation enforce a size change as well.
This way content is redrawn for the correct orientation.
It was done for Windows Phone 8.1 already, we only need to extent this
to Windows 10.

Task-number: QTBUG-50336
Change-Id: I6b3b964f44b631757ea856331c50f53c39ed9ec3
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-11 09:38:55 +00:00
Maurice Kalinowski
0c51277bb8 winrt: add logging to QWinRTScreen
Task-number: QTBUG-38114
Change-Id: Id653487a03ca2920c46cf16e45f28677a69fa570
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-11 09:38:51 +00:00
Maurice Kalinowski
71a36d0b65 Disable tests requiring shared build when compiling statically
Change-Id: I06ec53e46d2f61f1685899b0f8a4d385051095d6
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-11 08:30:27 +00:00
Marc Mutz
5bc54c878f QIBusEngineDesc: initialize all members when deserializing from older versions
De-duplicated code using, as suggested in
previous review, strategic gotos.

Change-Id: I4550dd8eff99789a41d8bb0b015bc4f51e3969fe
Reviewed-by: Takao Fujiwara <takao.fujiwara1@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-10 22:42:40 +00:00
Marc Mutz
adb377c89e ibus: mark some types as movable
These types are held in QVariant, and QIBusAttribute is also
held in QVector. Now that they are no longer polymorphic,
they can be marked as movable.

Remove user-defined dtors to unlock the implicit move special
member functions, which I enforce in my local tree for all
Q_MOVABLE_TYPEs. Add std::move() when appending QIBusAttribute.
QVector has rvalue-push_back().

Change-Id: Ibb359939d5c11b5ef1f8ceced9a051cdde452dd5
Reviewed-by: Takao Fujiwara <takao.fujiwara1@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-10 22:42:34 +00:00
Marc Mutz
747b39db66 ibus: de-virtualize QIBusSerializable hierarchy
These types don't inherit to be reused, they inherit to reuse.
Consequently, change the inheritance to private, remove the
virtual ~QIBusSerializable and rewrite the streaming operators
as member functions.

Remove the now-unused QIBusSerializable streaming operators and
meta-type registration.

Change-Id: Icf7a89174592ba62b39f73f0f016c8296cab5993
Reviewed-by: Takao Fujiwara <takao.fujiwara1@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-10 22:42:29 +00:00
Samuel Gaist
cf827f2167 Ported Qt 4 fix when getting an invalid native key on Windows
Task-number: QTBUG-36061
Change-Id: Ibde65735d861af4e1ef768e9e4314d30fed534a1
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-10 22:20:35 +00:00
Joerg Bornemann
ac8dae8b5e QLocalServer/Win: Fix race condition in listen().
Suppose a client connects while the QLocalServer is still in the loop
that calls addListener. The connection would SetEvent(eventHandle),
but every call to ConnectNamedPipe would ResetEvent(eventHandle).
Thus, the connection is never detected by the notifier on eventHandle.
  Callers of addListener must check the connection state of every
listener to make sure that no client connected while setting up
listeners.

Task-number: QTBUG-49254
Change-Id: Ia961927ea76973708e6e3f73510695eb5d6a0e4c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 17:32:49 +00:00
Allan Sandfeld Jensen
8589bb334f Enable most of tst_qstatictext on non-developer builds
Only two tests inside tst_qstatictext required private symbols, so
we can enable the rest on all builds.

Change-Id: Id222ba01d9676c40b6447c1526ee127fcc2090d3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 15:45:41 +00:00
Friedemann Kleint
2ec7f2cfed QSql tests: Remove Windows CE and clean up code.
Use the newly introduced QSysInfo::machineHostName() to determine
the host name in the shared header, removing the need to link
against the winsocket library. All Windows-specific .pro sections
can then be removed.

Task-number: QTBUG-51673
Change-Id: Iba990b886b16addd210639871065abde6de96516
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-03-10 15:07:02 +00:00
Friedemann Kleint
e82bdee165 QFactoryLoader: Add namefilter for Windows.
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>
2016-03-10 15:05:55 +00:00
Joerg Bornemann
39efe3c84d Fix glitch in tst_QLocalSocket::sendData
In one code path the test checked for the emission of a readyRead()
signal without waiting for it.
This code path was never hit, neither on Windows nor on Unix platforms.

Change-Id: Ifbe464400a2a1ba8eab49bd60315289040e6bbde
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 15:03:37 +00:00
Edward Welbourne
65f88f3a5d Deduplicate a condition to make clear that several cases ask it.
QNetworkAccessManager::createRequest() had three checks relevant only
to GET and HEAD requests; rather than testing for this in each of the
cases, test for it once and skip all three if it fails.  Tidied up the
residue of conditionals in the process.

Change-Id: I7baee8067a03afdc7cb0a77f1a50759dc4233843
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-03-10 15:01:09 +00:00
Edward Welbourne
6a2892bdef Skip spurious .toLower() on returns of QUrl::scheme()
QUrl::setScheme() parses and canonicalises the scheme, so that
scheme() always returns a lower-case string anyway; no need to
.toLower() it.

Change-Id: Ied00814b63f159386a42552dcf06346ee56f9f97
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-03-10 15:00:59 +00:00
Joerg Bornemann
52623d6d9d qmake: Remove Windows CE support.
The platform has been removed in Qt 5.7.

Change-Id: Ie768b5ffbe60270c27b4a670dcf580ea361cb361
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 13:33:44 +00:00
Olivier Goffart
c9210d392c Add argument names to the function signatures in headers
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>
2016-03-10 13:30:04 +00:00
Friedemann Kleint
390598cb43 Winmain: Remove Windows CE.
Remove #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library.

Task-number: QTBUG-51673
Change-Id: I473f215066db819a273f293940dcce9fe03152c3
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-03-10 13:28:13 +00:00
Friedemann Kleint
45dc347a95 tst_QStaticText: Output verbose message for test failures.
Factor out function to check on the pixel color that
outputs a verbose message on failure.

Change-Id: I2331fe45f35327d1ff8ae547a58d93a2e6fe9184
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-03-10 12:37:47 +00:00
Marc Mutz
1fd0d57ce3 qmake: fix UB in QMakeParser::putHashStr()
Found by UBSan:

  qmake/library/qmakeparser.cpp:278:33: runtime error: null pointer passed as argument 2, which is declared to never be null

Guard the call.

Change-Id: I99341ab439a511f366dae9344ddcc8727c33b9b6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 12:30:46 +00:00
Oswald Buddenhagen
f3487308e4 fix file separators in target.targets INSTALLS
Task-number: QTBUG-51775
Change-Id: I8d9442bfd5084f1670b79dfdd422638bc62780aa
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-03-10 12:21:57 +00:00
Allan Sandfeld Jensen
5655d061b2 Xft antialias settings must not override requested NoAntialias
If Xft enabled font antialiasing, QFont::NoAntialias would have no
effect as it would be overridden.

Change-Id: I4dae264bc6674ae81f181cc9ce85851174d42544
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-10 12:11:26 +00:00
Eskil Abrahamsen Blomfeldt
713282dfe4 Deobfuscate SFNT tag creation on Windows
The fact that we override the big endian MAKE_TAG macro
(from qfontengine_p.h) with a little endian version on Windows
caused some confusion and was a bug waiting to happen. This patch
renames it instead to avoid future confusion.

Change-Id: I6224a4bfbd80eafc849ecd82e7fe5f83ee1953af
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-03-10 11:58:53 +00:00
Eskil Abrahamsen Blomfeldt
437f5662d3 Allow overriding Android NDK host on Windows
The -android-ndk-host argument to configure existed in the shell
script, but not in the Windows version. When using a 64-bit NDK
but a 32-bit host compiler (which is what we bundle with our
SDK), we would not detect the correct NDK host, making it impossible
to build Qt with this combo.

[ChangeLog][Android] Added -android-ndk-host configure option on
Windows.

Change-Id: Ie6a92b66e6875ed53f46fe41ecced70c3ec67585
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 11:57:39 +00:00
Marc Mutz
fb196e8807 QMimeMagicRule: fix UB (misaligned load) in matchNumber<T>()
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>
2016-03-10 10:57:53 +00:00
Friedemann Kleint
62e0a98282 Fix debug operators for QPageSize/QPageLayout.
Remove placeholder formatting and add noquote.

Change-Id: I4a89f88778caf007ce42bbf57edfb514fe76bcdb
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2016-03-10 10:53:51 +00:00
Marc Mutz
807240a883 QJsonParser: fix UB (misaligned store) in Parser::parseNumber()
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>
2016-03-10 09:45:34 +00:00
Marc Mutz
f647375275 Fix signed integer overflows in tst_QAtomicInteger
Signed integer overflows and underflows are undefined
behavior. A test that invokes UB tests nothing, because
the standard permits any outcome.

Fix by guarding the respective operations so
they are not executed if they would overflow
or underflow.

Change-Id: I40354ee88f40e4b47b70eac7790dc3a79ac70a57
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-10 07:17:55 +00:00
Gabriel de Dietrich
85a57f7a2e Wheel event widget: Harden logic an extra bit
This is quite an unlikely scenario, but not impossible.

It could be that the wheel widget is destroyed during
an update phase event. In that case, wheel_widget would
be a dangling pointer for any subsequent wheel event.
We protect against this with a QPointer.

However, that would mean that if the next wheel event
were to be an end phase event, that event would be lost.
So we go through the usual code path, except that we won't
set wheel_widget in the case of an end phase event.

Change-Id: I59a912b845dcc249e1edc60b4dc28bf308d807d9
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-03-09 23:46:50 +00:00
Marc Mutz
2020d2cb63 QObject: fix GCC 6 warning about qt_static_metacall's 'hidden' attribute use
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>
2016-03-09 20:11:28 +00:00
Alex Trotsenko
8042c5243c QAbstractSocket: remove unnecessary checks
There is no need to check the 'enabled' states before calling
set{Read|Write}NotificationEnabled() functions, because the socket
event notifiers are fully optimized for this case.

Change-Id: I0cd4fbc2298c9b9523420a60a46a65e0b305fa12
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-09 15:51:32 +00:00
Dyami Caliri
f8f1bac3f0 Accept LFCRLF to mark end of HTTP Headers
Some embedded servers use LF to mark the end of an individual header,
but use CRLF to mark the end of all the headers. The GoPro WiFi
interface does this, as an example.

Change-Id: I227ab73622c84f439a6cf8703d020393c4d8bf69
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
2016-03-09 15:47:18 +00:00
Shawn Rutledge
d7db6c6c19 xcb: mark mouse events from tablet devices as synthesized
Task-number: QTBUG-51617
Change-Id: Ic1d258c56165947ff821b1bf4d044bcf29b41a3b
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-03-09 14:42:30 +00:00
Friedemann Kleint
d29443c9c8 Manual touch test: Remove QDebug operator for QTouchDevice.
It now exists in QtGui.

Task-number: QTBUG-48849
Change-Id: I9107c96e0010252bc50bcb02ef006cb46bd942df
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-09 14:26:04 +00:00
Volker Krause
ce7fa976aa Add device mkspec for NVIDIA Jetson TK1 development boards.
Despite the very similar name and hardware, the software stack is
completely different compared to the Jetson TK1 Pro we already have
a mkspec for.

Change-Id: I45353ece195035e961ff47df55d6361569aabb04
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-03-09 13:53:34 +00:00
Jarek Kobus
cb24903ef4 Generate QVariant::fromValue(enum_value) for enum values
Instead of just QVariant(enum_value).

Task-number: QTBUG-49383
Change-Id: Id57c65b68d4328816046bc35301dc6afba47b727
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-09 13:51:39 +00:00
Friedemann Kleint
7d374b7ba6 QString::vasprintf(): Use quintptr when casting pointer for %p.
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>
2016-03-09 13:45:26 +00:00
Marc Mutz
62e89f4745 tst_QMetaType: fix misleading indention
As found by GCC 6:

  tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1476:9: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
         tn += ">";
         ^~
  tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1474:5: note: ...this ‘if’ clause, but it is not
     if (tn.endsWith('>'))
     ^~

Fix += argument from char[2] to char as a drive-by.

Change-Id: I814dc58830934cac7fcf81eb7fd7564b2abeb631
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-03-09 13:18:26 +00:00
Marc Mutz
3856099d9a QGestureManager: fix UB in filterEvent()
The code infers from the presence of an address in a
QHash<QGesture *, ...> that the address belongs to a
QGesture. So far that is fine enough.

But in order to perform the lookup, it static_cast<>s
the QObject* argument to a QGesture* for the QHash::
contains() call. Even though the pointer is not
dereferenced, the cast is UB. Says UBSan:

  qgesturemanager.cpp:558:73: runtime error: downcast of address 0x2ab83364f3a0 which does not point to an object of type 'QGesture'
  0x2ab83364f3a0: note: object is of type 'QDBusConnectionManager'

which is a particularly hideous error message because
of the constantly-changing completely-unrelated actual
type in the second line of the message:

     52 QDBusConnectionManager
     19 QSocketNotifier
     14 QFusionStyle
     13 QAction
      6 QApplication
      3 QGraphicsWidget
      1 Window
      1 TestRunnable
      1 RectWidget
      1 QTimer
      1 QSingleShotTimer
      1 QOffscreenSurface
      1 QGraphicsProxyWidget
      1 QDefaultAnimationDriver
      1 QDBusPendingCallWatcherHelper

This error is also _very_ common, triggered 116 times
in a single run of make -C tests/auto check.

Fix by using qobject_cast first and then doing the
lookup only when the cast succeeded.

Depending on the performance of qobject_cast<>, this
may actually perform better, too.

Change-Id: I884ec7d885711acc3c1d004ce93c628268d8fc18
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-09 13:18:19 +00:00
Marc Mutz
1bfc7f680f QString, QJson, QHash: Fix UBs involving unaligned loads
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>
2016-03-09 13:16:19 +00:00
Anton Kudryavtsev
9dcbffabbd CoreLib: replace Java-style iterators
... 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>
2016-03-09 09:57:28 +00:00
Marc Mutz
1b441c3941 Q*Application: fix UB caused by accessing QGuiApplication from QCoreApplication ctor
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>
2016-03-09 07:42:50 +00:00
Marc Mutz
fb7ef2b9f5 QCosmeticStroker: fix out-of-bounds access in drawPixel()
Found by UBSan:

  src/gui/painting/qcosmeticstroker.cpp:150:55: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]'
  src/gui/painting/qcosmeticstroker.cpp:150:99: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]'
  src/gui/painting/qcosmeticstroker.cpp:151:55: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]'

That code path makes no sense if no span has been populated
yet, so skip the whole block if current_span == 0.

Change-Id: I832b989e89c118dc48ab5add3a28bb44c1936a76
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
2016-03-09 05:41:41 +00:00
Peter Seiderer
e69e695196 Disable c++ standard compiler flags for the host build
There is no test for c++ standard support for the host build
(only for the target compiler/build) which leads to trouble
in some cross compiling environments (old host compiler, new
cross compiler):

  g++: error: unrecognized command line option ‘-std=c++1z’

So disable c++ standard compiler flags unconditionally for host builds.

Task-number: QTBUG-51644
Change-Id: Ifb3042e125fe199a7e081740d1171d26ccacf0c5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-08 19:30:04 +00:00
Erik Verbruggen
27a2a02559 iOS: Disable usage of crc32 intrinsics.
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>
2016-03-08 17:55:14 +00:00
Erik Verbruggen
15ddb7f841 ARMv8: fix crc intrinsic usage.
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>
2016-03-08 17:55:13 +00:00
Friedemann Kleint
feca9d95c1 Add missing "We mean it." warning to qnetworkfile_p.h.
QtNetwork: WARNING: qtbase/src/network/access/qnetworkfile_p.h does not have the "We mean it." warning

Task-number: QTBUG-45925
Change-Id: I9cd9237450101c4c862746e774fa37d69083c213
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-03-08 15:17:19 +00:00
Friedemann Kleint
4ef990ce4a tst_QKeyEvent: Fix MSVC warning about 64bit shift.
tst_qkeyevent.cpp(140): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)

Change-Id: Id3e0eea125f7f7ec13f9b9428e034b922d2ce204
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-03-08 14:57:14 +00:00
Friedemann Kleint
37cfcfb2b5 configure: Remove Windows CE.
The platform has been removed in Qt 5.7.

Task-number: QTBUG-51673
Change-Id: Id0b26e94bd8a673a35bfa5e02a5ba1c30891764a
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-03-08 14:41:14 +00:00