Commit Graph

26481 Commits

Author SHA1 Message Date
Thiago Macieira
72f8f994b2 QSemaphore: attempt to fix again the 64-bit Linux semaphore
This time, the issue was that we could race a wait and a wake. A multi-
token waiter would not notice that the number of tokens changed because
it only performed a fetch-and-OR, then waited on the high part which did
not change. That means the futex_wait() would succeed, when we wanted it
to have failed.

So we have to bring back a portion of what commit
081c001deb removed: we need to keep both
the token count and the waiter count in the high word.

Task-number: QTBUG-67214
Change-Id: I04a43ee94975482f9e32fffd151e467a9e0030b3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-03-29 15:15:03 +00:00
Mauro Persano
2e496e9322 Windows: handle multiple transient children when closing windows
On Windows, we must update the transient children of a window that's
about to be destroyed or its transient children will be destroyed as
well. This is already being done in the case of a single transient
child, but there are still problems when there are more than one.

Change-Id: Ib0de6767bf43dca508ecdb87cbdfedb59e9146e8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-03-29 15:07:45 +00:00
Jürgen Hunold
ee6164942d Allow compilation with clang-cl disguised as cl
Task-number: QTBUG-63512
Change-Id: I7e0c4e144262a175c39508090c935c73186fac65
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-03-28 18:18:05 +00:00
Kari Oikarinen
f22ae9c0d0 QFutureWatcher: Refer to convenience method resultAt in documentation
The future does not actually have a result() member function that takes an int.
The correct function is resultAt(). But that is also available directly in the
QFutureWatcher, so refer to that instead of advising to get to the future.

Change-Id: I53d267b4b48b1171bf611e11130b9dacabc059a4
Reviewed-by: Martin Smith <martin.smith@qt.io>
2018-03-28 11:40:30 +00:00
Olivier Goffart
c59cb98095 Fix MSVC2017 compilation with enabled relaxed constexpr on 32-bit target
The problem is that qCountLeadingZeroBits is calling qPopulationCount
which is only conditionally constexpr, so qCountLeadingZeroBits can only
be marked constexpr if qPopulationCount is also.

On MSVC2017 64bit this is not a problem because it uses builtins function
in this case. (which is not constexpr, but it works because the compiler
is not forced to diagnose the problem because of the "?:" operator.

The error being fixed is:

  qalgorithms.h(847): error C3615: constexpr function 'qCountLeadingZeroBits' cannot result in a constant expression
  qalgorithms.h(858): note: failure was caused by call of undefined function or one not declared 'constexpr'
  qalgorithms.h(858): note: see usage of 'qPopulationCount'

Task-number: QTBUG-67259
Change-Id: I65a3dfae12ca49394bec14ffefdd41a07fee1c32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-03-28 08:16:57 +00:00
Gabriel de Dietrich
e83f1900f6 QMacStyle: Fix spinbox implicit height
We don't need to accommodate for the fake frame anymore.

Change-Id: I2d84441d4239e1ff68f640dffda1a0d1a97fa2b3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-27 17:13:44 +00:00
Gabriel de Dietrich
857e73e042 QMacStyle: Fix text color for disabled default buttons
Change-Id: I7c6ba0c3818a3e269e0350153cbde355bafd249a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-27 17:13:39 +00:00
Gabriel de Dietrich
76bec0c49a QMacStyle: Remove CT_ToolButton related dead code
sizeFromContents() just adds 10 points to the tool button
size and returns. Therefore, the HITheme code that used
to be shared with CT_PushButton becomes effectively dead.

Change-Id: Ib0519b0037ec3097a00e2c14067d851040853499
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-27 17:13:32 +00:00
Gabriel de Dietrich
50428e9727 QMacStyle: SE_PushButtonContents is HITheme-free
This also removes a few HITheme-related functions that
are no longer needed.

Change-Id: I356938d1e99f5fed106c945a94050fa35db58716
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-27 17:13:27 +00:00
Gabriel de Dietrich
2562fe35cf QMacStyle: Do manual button sizing for CT_PushButton
We guarantee the same sizes as previously with HITheme
for most common cases. Exotic cases may break and will
be fixed along the way.

Change-Id: I3e3e6ea702c7489c1cbaa821a30916f63c440c1f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-27 17:13:21 +00:00
Andy Shaw
7775eb248a sqlite: Support using execBatch() with duplicated named placeholders
Also expands the tst_qsqlquery::batchExec() test to account for this
case and generally test the functionality. In addition it is made to be
more robust to avoid any discrepencies with the testing data. The test
in general is also cleaned up to enable more of it being tested with
the different database drivers where possible.

An expected fail is added for MySQL due to the fact that it has a bug
where null timestamp entries are being converted to the current
datetime when adding it as a bind value.

Change-Id: I0061bd1c69ae35b4858afc49420f13ce59cf48ae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-03-27 16:50:19 +00:00
Pablo Marcos Oltra
c2373fce3c macOS: Fix memory leak in systemCaCertificates
We were releasing only the memory of latest iteration since cfCerts
was being rewritten in every iteration, invalidating the RAII.
Hence, we need to define the variable within the loop to ensure the
object is released for every iteration.

Task-number: QTBUG-66937
Change-Id: Iaa9365168728337c6cdaac4aef686652903cf5a9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-03-27 04:15:37 +00:00
Eirik Aavitsland
c7c41fa1c6 Fix QPainter save/restore of clipping enabled state
Clipping enabled state would not always be correctly restored for the
raster engine (other engines work fine). The raster engine's QClipData
object is sometimes shared between painter state objects on the
save/restore stack. QClipData has its own enabled flag, and this could
then come out of sync. Fix by making sure we sync the enabled state on
restore.

Task-number: QTBUG-58789
Change-Id: I81e6254ebb93df6e153bbef58e32a885273e3224
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-03-26 16:00:43 +00:00
Svenn-Arne Dragly
50cfbd6112 Animation: Fix case where QEasingCurve::valueForProgress returns nan
Previously, we would divide by zero in BezierEase::findTForX if factorT3
was zero when solving the cubic equation.

This change fixes the problem by adding solutions for the special cases
where the cubic equation can be reduced to a quadratic or linear
equation.

This change also adds tests that cover cases where the equation becomes
quadratic, linear or invalid.

Task-number: QTBUG-67061
Change-Id: I2b59f7e0392eb807663c3c8927509fd8b226ebc7
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
2018-03-26 15:53:10 +00:00
Thiago Macieira
411a4cb67c QNetworkInterface/Linux: fix support for P-t-P tunnels
The kernel stores the local address in IFA_LOCAL and the peer's address
in IFA_ADDRESS. My testing with loopback, Ethernet, WiFi, OpenVPN TAP
and TUN and Openconnect shows IFA_LOCAL is always passed and always
correct, so we could have used just that, but let's leave the use of
IFA_ADDRESS because that's also what all libcs' getifaddrs() do.

[ChangeLog][QtNetwork][QNetworkInterface] Fixed a regression in
reporting the local address of a point-to-point tunnel network
interface.

Task-number: QTBUG-67226
Change-Id: I04a43ee94975482f9e32fffd151eb393d1775580
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-03-26 15:17:38 +00:00
Friedemann Kleint
dbc983a513 Revert "Detect C standard and try using the most recent"
The change causes a crash when compiling the xkbcommon 3rdparty
library and compile failures (qtimageformats on Android).

This reverts commit a47cb14680.

Task-number: QTBUG-67326
Task-number: QTBUG-67327
Change-Id: I5ddc4eccad699e3eaec535fd6a63d11b0026b42e
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-03-26 15:10:33 +00:00
Eric Lemanissier
edf96b984d fixup oversight in rvalue overloads of operator+=() and operator<<()
ammends 4dee5446be

Change-Id: Ia0ca27644eb71815a93d6e76681b8a9e61a4e7ab
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-03-26 14:29:47 +00:00
Kevin Funk
02ed1b36da Remove CMake code for CMake < 3.1
This removes the following functions from Qt5CoreMacros:
- qt5_use_modules(...)

Task-number: QTBUG-63519
Change-Id: I59769060a3a93686bf319b558c0ede55755fdb70
Reviewed-by: David Faure <david.faure@kdab.com>
2018-03-24 22:31:18 +00:00
Christian Ehrlicher
69948f4899 QSqlResult: use QVector<int> instead QList<int> for indexes value
Minor tweak: QList<int> is taking 64bit per entry, QVector<int>
only 32bit - this should reduce memory usage a little bit.

Change-Id: I3e17269feb4840343f5cecfc71f8fccd70edc80f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-03-23 17:03:23 +00:00
Rolf Eike Beer
25956a1e7c DBus: merge calls to set_source_files_properties() in CMake functions
This can handle multiple files at once just fine.

Change-Id: I9dcf7b0c72df432f02200ac7f3967f36a408f306
Reviewed-by: David Faure <david.faure@kdab.com>
2018-03-23 16:38:56 +00:00
Sergio Martins
54507e25d4 Fix win32-clang-msvc build due to -Werror,-Wunused-private-field
Task-number: QTBUG-63512
Change-Id: Ie1507faffc11be09d9ce5e95c3b537dd65bb6978
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-03-23 15:16:01 +00:00
Eirik Aavitsland
d5b9a4ebc4 Fix: avoid realloc when adding primitives to painterpath
Calling reserve() for every primitive added would defeat QVector's
over-allocation strategy to avoid reallocs.

Task-number: QTBUG-66677
Change-Id: I7bdafdfa4d3ef60b00752c11e1b803abba773658
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-03-23 08:18:01 +00:00
Richard Moe Gustavsen
915fa58060 QTableWidget: fix spelling error
Change-Id: Ifd6f116a214d13328ccf0d070ef4517a3b53bf25
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2018-03-23 08:16:59 +00:00
Mårten Nordheim
443a98e881 Document an odditity in WinRTs SSL backend
Internally we use "Tls11" and "Tls12" from Microsoft's API for TlsV1_1
and TlsV1_2 respectively. However, in their documentation these values
are defined to also include the lower TLS versions when you use them.
We should document this.

For "SslV3" TLS V1.0 support will also be enabled.

https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.socketprotectionlevel

Change-Id: I0b20fb745eba40afc37e8430008872fc8174a72d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2018-03-23 07:52:18 +00:00
Oliver Wolff
f6ec2ea8a1 winrt: Fetch connection parameters when connection is successful
Change-Id: Iaf5f5d93cd07429626d5c500ac04e67daada8e6e
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-03-23 07:13:52 +00:00
Oliver Wolff
1f77332db0 winrt: Remove partially read datagrams from queue
According to the documentation, datagrams that were
not completely read are discarded.

Change-Id: Id3a038d8aeeba05e8c8f92b70877f5f5297b89ca
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
2018-03-23 07:13:51 +00:00
Oliver Wolff
6696c37e00 winrt: Add initial setting of options and additional state checks
The initial settings are done for other socket engines too.

The state checks return a message when they fail. Socket engine
auto tests rely on these messages to be shown.

Change-Id: If7734b453a24ecee4c3a028395ecdbb12859c871
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
2018-03-23 07:13:49 +00:00
Oliver Wolff
e72b583bc2 winrt: Remove unneeded function
Change-Id: I62f3abcabf1a0e5f909c603cbdcf407e36bd0402
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
2018-03-23 07:13:49 +00:00
Oliver Wolff
f3db6971ee winrt: Rework socket handling
Buffer handling is now completely moved to the worker. Instead of
moving data around all the time, the worker is responsible for
buffer handling. When reads happen, the data that is read is used
directly from the worker and its buffer is updated.

With the previous approach it was possible, that transfers never
completed. It was possible, that new data was read between calls
of bytesAvailable and read and the availability of that data was
never communicated to the user. If a read that does not read all
the data happens, we signal, that there is still data available,
so that the user is notified about that fact. At the same time
we avoid unnecessary readyRead calls by blocking them until a read
happens.

To make future debugging sessions easier, categorized logging
(including verbose) was added to the socket engine.

Task-number: QTBUG-65556
Change-Id: I12020ffcccf8eb3efec9c36dc5b0e6c0ebef7eb5
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2018-03-23 07:13:47 +00:00
Allan Sandfeld Jensen
1d616e764d Avoid of bounds memory reads when scaling and mirroring images
The bounds check we had wasn't complete for mirroring cases.

Task-number: QTBUG-65387
Change-Id: I5333912621c1223f83b4f1b95f2b16d12b520bd2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2018-03-22 23:47:25 +00:00
Gabriel de Dietrich
fae42e1e73 QMacStyle: Don't highlight square buttons text when pressed
Native square buttons keep their text black when pressed or on.

Plus using the QStyleOptionButton variable over the QStyleOption
one where appropriate.

Change-Id: Idba8197e64d408e8a0987f1ef9243fde08e3e839
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-22 21:25:24 +00:00
Gabriel de Dietrich
b8dc00ea4b QMacStyle: Refactor button sizing
We prepare for a better world without HITheme.

Sadly, we can't guarantee Cocoa will be good enough as a
replacement. So, expect more hardcoded values and margins.

Change-Id: I915906b5dbfbfbfc8c7f5c3224fc0ed98562bb9f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-22 21:24:56 +00:00
Gabriel de Dietrich
3e665c8df8 QMacStyle: Make CE_PushButtonBevel square if large enough
Meaning, if larger than the size of a regular NSButton.

No intermediate size square buttons anymore. We'll try to get
the closest one later, once the sizing problem is solved.

We also refactor the button creation code a bit.

Change-Id: I965520469546aea596cd1abec2309b40d70399ce
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-22 21:24:35 +00:00
Gabriel de Dietrich
bec1e609ec QMacStyle: No more HITheme for CC_ToolButton
As for CE_PushButtonBevel, sizing is still pending. These
two seem to go together anyway.

Change-Id: I631c3f32ba201b16adbfa264a2920bfb636fb86f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-22 21:24:12 +00:00
Gabriel de Dietrich
e3561dbda0 QMacStyle: No more HITheme for CE_PushButtonBevel
For rendering only. Sizing is still pending and, consequently,
square buttons since these depend on the button's intrinsic size.

Change-Id: Iacadc02a1a75970b221543b32ca724c92e118ce1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-22 21:24:05 +00:00
Gabriel de Dietrich
3691c41115 QMacStyle: Make CocoaControl a full type
And one small code clean-up.

Change-Id: I57c71ce2e18c95529ee45ba4fdfc68e21209e384
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-03-22 21:23:59 +00:00
Pasi Petäjäjärvi
14157a1a3e Add env variable to set QNX screen debugging information
Enables different QNX Screen graphics system information
as overlay.
Following are valid options for the env variable:
* fps, posts, blits, updates, cpu_time, gpu_time, statistics

More info:
http://www.qnx.com/developers/docs/7.0.0/index.html#com.qnx.doc.screen/topic/group__screen__debugging_1Screen_Debug_Graph_Types.html

Change-Id: I8cbee44de31bb2aaf3892a063769f4740027242b
Reviewed-by: Adam Treat <adam.treat@qt.io>
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
2018-03-22 13:37:10 +00:00
David Edmundson
ee54df0311 Support GLX_NV_robustness_video_memory_purge in XCB-GLX
Nvidia doesn't handle suspend very well in Linux and textures get
corrupted. To handle this Nvidia has a bespoke extension to query when
this has happened.

This patch checks if graphics have been reset and invalidates the
surface.

Task-number: QTBUG-56610
Change-Id: I0b97d539ce6cc2b9cfe41c71bf6efd4f68496cd6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2018-03-22 08:23:18 +00:00
Andy Shaw
f4435d2d5c offscreen: Check that native interface is valid before using it
If the offscreen platform plugin is used on Windows then it can end up
crashing since there is no native interface. This prevents a crash from
occurring when these functions are called.

Change-Id: I526fc0703771fa5f85b26d182ad3b15ef1a3ada5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-03-21 18:11:49 +00:00
Thiago Macieira
d3b6ef6ccf QFile::rename: fix the error message if renaming a file by copy fails
The QFile out variable cannot be open because if out.open() succeeded,
we could never reach this line. Instead, we want to capture *why* either
the source or the destination failed to open.

Task-number: QTBUG-66445
Change-Id: I940917d6763842499b18fffd15142f231bf34a47
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2018-03-21 14:23:53 +00:00
Thiago Macieira
79493a3ee1 Make QCOMPARE(-inf, -inf) and QCOMPARE(NaN, NaN) succeed
This will make two floating points containing NaN compare as equal,
instead of the regular nan != nan IEEE behavior (which isn't very useful
in a unit-test framework).

Note that this does not apply to indirect comparisons, for example via
QVariant.

Change-Id: I39332e0a867442d58082fffd150851acfdd18c23
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-03-21 14:23:13 +00:00
Ulf Hermann
6e8e9979d0 Make sure we can build with -no-feature-itemmodel
Various pieces of code have to be disabled in this case.

Change-Id: I83b133f17e9f024016a79c9103293627185449d2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-21 14:00:29 +00:00
Allan Sandfeld Jensen
a47cb14680 Detect C standard and try using the most recent
Fixes the default C version used with gcc < 5

Change-Id: I948dece961caed8e6b181e1c6e6b9dc43c46583f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-21 13:52:10 +00:00
Marcel Krems
5f66486cc2 Fix crash when deleting a QSqlQueryModel after closing the database
Task-number: QTBUG-66553
Change-Id: Ib5c04ebe5ac2b7581613e0044804072eb0980b2e
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2018-03-21 13:50:43 +00:00
Nathan Collins
992f673782 macOS: Handle NaN mouse event positions
When performing gestures such as Exposé or Mission Control with the
mouse button down, the position of the mouse release event is
returned with NaN values. This causes
QGuiApplicationPrivate::processMouseEvent to be called recursively
and ultimately crash.

Task-number: QTBUG-67194
Change-Id: If1536bc4dc2075c498cdd6c5afe57c86bdaac13b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-03-21 10:45:47 +00:00
Ulf Hermann
955cf40b18 Testlib: Add a feature for the item model tester
It depends on QAbstractItemModel, so we need to switch it off if
itemmodel is unavailable.

Change-Id: I97246767a5e387b7a2cee90c34125a8411ef1c4e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-21 10:31:08 +00:00
Ulf Hermann
4db38197c2 Testlib: Rename qtest_global.h to qttestglobal.h
This follows the naming convention for global headers and causes
qttestglobal.h to be added to the top of the generated QtTest header. It
is necessary to have it there when other headers depend on features
defined in configure.json.

[ChangeLog][QtTest] The qtest_global.h header is now deprecated. Include
qttestglobal.h instead.

Change-Id: Iaed639d4e13dd99cee6387fce9d15d6e55b0b1e8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-03-21 10:31:01 +00:00
Mårten Nordheim
4a56d86ee4 Make QSsl::SecureProtocols also enable use of TLS1.{1,2}
Previously it was only enabling use of TLS1.0, unlike our openssl
backend, which understandably caused some confusion among some of our
users.

Seeing as this is also the default value in QSslConfiguration it is nice
to have it negotatiate more secure ciphers.

Task-number: QTBUG-67112
Change-Id: Ie216703da1ec4e6b973a881040e14816ad4c0a32
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2018-03-21 10:30:48 +00:00
Morten Johan Sørvig
45c62aae4b Cocoa: Restore resizable window mask setting to 5.9 behavior
This should be tied to the CustomizeWindowHint flag:
if that flag is set we start out without NSResizableWindowMask
and possibly add it later on if WindowMaximizeButtonHint
is set.

Change-Id: I7e826d4bd357a8a17c60cfef948af25d61b66ebf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-03-21 10:25:55 +00:00
Friedemann Kleint
f1bf7eb34a qtestlib/Unix: Output function time and total time in case of a crash
This helps to distinguish timeouts from real crashes in COIN.
This is already done for Windows.

Change-Id: I4daeafa36f50482d20cea4bd1106647081ff7abe
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2018-03-21 10:22:00 +00:00