Commit Graph

40891 Commits

Author SHA1 Message Date
Volker Hilsheimer
b7d073e990 Refactor memory allocation for arguments of QMetaCallEvents
There are two cases:

In a BlockingQueuedConnection, QMetaCallEvent doesn't allocate memory
and instead passes already existing pointers through. A QSemaphore
is used to serialize data access between threads. So the constructor
taking a QSemaphore can be simplified to only accept an existing arg
array.

In a QueuedConnection, QMetaCallEvent needs to make deep copies of
the arguments, and memory needs to be allocated based on the number
of arguments. The previous code put the burden of memory allocation
on the code generating the event, while the memory was free'd by
~QMetaCallEvent. Instead, make it QMetaCallEvent's responsibility
to allocate and free the memory as needed, and adjust the code
generating QMetaCallEvents.

We can allocate the memory for types and pointers to arguments in a
single block, starting with the space for the array of void*, followed
by the space for the array of integers to avoid byte alignment issues.
By pre-allocating the space that's needed by three arguments, we can
avoid all mallocs for the majority of QMetaCallEvents.

Until this change has propagated through qt5.git, we need to keep the
old API that is still used by QtDeclarative around. Once QtDeclarative
has migrated to the new API, it can be removed.

Change-Id: Id7359ffc14897237ea9672dabae9ef199a821907
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-10 22:04:11 +02:00
Joerg Bornemann
e75aed1a96 Warn about conflicting DESTDIR/TARGET combination in debug_and_release
If a project has DESTDIR and TARGET set to fixed values, then the
target paths conflict when doing debug_and_release builds.

With this change we're detecting this situation and yield a warning.

Fixes: QTBUG-2736
Change-Id: Ib163db3463322792ab9fa5b997285ac9fc9819ab
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-08-09 10:29:28 +02:00
Joerg Bornemann
38cfd3a8cb tst_qmake: Pass /nologo to jom like we do for nmake
Change-Id: Id9b2ac4dd7d591d471d3e21e8d78d4915620a2c1
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2019-08-09 10:29:03 +02:00
Marc Mutz
3ed21726ec Give some TLC to QAppleRefCounted
- add conditional noexcept to move special member functions
- use qExchange() in the move ctor implementation (turns a copy into a move)
- separate the default ctor from the ctor that acquires a resource, then
- overload the latter for rvalue payloads

Change-Id: I6816143a94fe6a74cf0d02569b83a752a8da3089
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-08-09 07:36:26 +00:00
Simon Hausmann
aca43d29f8 Fix sign change warning
The conversion from int to uint is deliberate here, so let's cast and
avoid a warning for users compiling with warnings enabled.

Change-Id: I7136d6161ace735be49f8d987338f6d401a5c78a
Fixes: QTBUG-77245
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-08-09 09:32:59 +02:00
Nils Jeisecke
9c891bead8 QTextDocument: add manual test for table border logic
This adds a manual test for the QTextTable border logic.

Two HTML files are bundled as resources:

table-border-test.html: Contains various test cases for the border
logic.

table-border-test-header.html: Contains a test case for printing a table
with a repeated header.

The test application allows:
- editing
- previewing
- printing
- opening the HTML in the system browser (via temp. file)

It is possible to edit the HTML with "live preview" so new test cases
can easily be implemented.

Change-Id: Ic88488bc8b7dd74d5c03c3363f55840423462325
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-08-09 07:21:25 +00:00
Yuhang Zhao
d502b19b28 Fix std detection for win32-clang-msvc
clang-cl will never support C++ standards newer than
C++14 without these flags.
I didn't add them to msvc-based-version.conf because
on Windows, only clang-cl use the same flags with MSVC,
both ICC and MinGW have their own flags. So they are
clang-cl specific flags.

Change-Id: Ia44a5ea4237c77ea5e897fffded32cbc008a4729
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-08-09 15:16:18 +08:00
Thiago Macieira
48b3ec6e8e QBitArray: change modulo 8 with bitwise-AND 7
They're the same only for unsigned values. Modulo of negative numbers
since C++11 has an expected behavior and generates more code:

%rax = %rax & 7:
        andl    $7, %eax

%rax = %rax % 8 with GCC:
        cqto
        shrq    $61, %rdx
        addq    %rdx, %rax
        andl    $7, %eax
        subq    %rdx, %rax
[read as ((%rax + (%rax < 0 ? 7 : 0)) & 7) - (%rax < 0 ? 7 : 0))]

With Clang:
        movq    %rax, %rcx
        sarq    $63, %rcx
        shrq    $61, %rcx
        addq    %rax, %rcx
        andq    $-8, %rcx
        subq    %rcx, %rax

Change-Id: Ife213d861bb14c1787e1fffd15b83b004be7eba0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-08-08 20:29:32 -07:00
Thiago Macieira
6ce9404a6e QBitArray: fix fromBits() and actually test it
When I initially added it, it was ony for QCborValue, but I never added
the tests. Turns out there were two bugs:

[ChangeLog][QtCore][QBitArray] Fixed two bugs that caused QBitArrays
created using fromBits() not to compare equal to the equivalent
QBitArray created using other methods if the size was zero or not a
multiple of 4. If the size modulus 8 was 5, 6, or 7, the data was
actually incorrect.

Fixes: QTBUG-77285
Change-Id: Ife213d861bb14c1787e1fffd15b70573d162042c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-08-08 20:27:04 -07:00
Soroush Rabiei
c595878aa3 Extract a large format string as a module constant value
The template for the "This is a generated file" notice made a clumsy
intrusion in the code in which it appeared, so split it out as a
constant of the module and access it by name where it's used.

Change-Id: Ic4dfb8e873078c54410b191654d6c21d082c9016
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-08-08 18:04:05 +02:00
Joerg Bornemann
ee8509d6cb QMakeLocalFileName: remove mutable specifier from real_name
There is no need to have both QString member mutable.

Change-Id: I592963b7c66e564b918d750fb47e903df0b0f9bc
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-08-08 17:05:19 +02:00
Shawn Rutledge
9e8cf8f75b doc: Fix text formatting in the CSS Properties table
Every property name was already monospace, except this one.

Change-Id: I69f4e7cd67e6d4ab2a25b4f1d251ec5a2c925098
Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-08-08 16:46:13 +02:00
Nils Jeisecke
8664ee610d QTextDocument: allow css-styling of table cell borders
This allows to set the width, style and color of each table cell's edge
(left, right, top, bottom).

Setting the table's border-collapse mode will disable explicit cell
spacing. The basic CSS border collision rules are applied (wider border
wins, vertical over horizontal).

Setting the table's border width to a value >= 1 and enabling
borderCollapse will now draw a simple and clean table grid (1px) with an
outer border of the specified width and color.

[ChangeLog][QtGui][QTextDocument] Added CSS style table cell border
formatting with border-collapse mode.

Change-Id: I324d82284802df4c88c13c5b902fec1f4768b67e
Fixes: QTBUG-36152
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-08-08 16:46:09 +02:00
Joerg Bornemann
39e937a538 Fix host architecture detection for canadian cross builds
If the host architecture is different from -platform (canadian cross
build with -external-hostbindir) then we cannot use QMAKE_HOST.os to
deduce the executable extension for that platform, because this value
comes from the qmake binary that was pointed to by
-external-hostbindir.

Move the target name deduction mechanism to the actual configure test
.pro files to make sure the right scopes are available, and write the
deduced target name to a text file. That text file is read by
qtConfTest_architecture to get the right binary to analyze.

Fixes: QTBUG-77286
Change-Id: I68b844dd51dbfda6432a4b0dca6331899c82255f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-08-08 14:26:11 +02:00
Heikki Halmet
c76b86aec6 BLACKLIST contains_QPointF for msvc-2019
Task-number: QTBUG-77312
Change-Id: I5197d160d9b3c70b538c2e5a43c31120e1bed5f0
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2019-08-08 15:20:23 +03:00
Timur Pocheptsov
aef0fba3c5 QCocoaMenuLoader: get rid of lastAppSpecificItem
Look it up when needed instead. Also, simplify our
ownership logic - do not retain/autorelease that
is already owned by a menu (via its itemArray).

Fixes: QTBUG-76523
Change-Id: I60a2ed0d192396baf99eec7b37fa5cc10e5db626
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-08-08 13:15:36 +02:00
Lars Knoll
afb326f071 Refactor lockedAlphaMapForGlyph
Simply return a Glyph pointer and not a QImage to avoid allocating and
deleting lots of d pointers for QImage when drawing text. Saves one
new/delete pair per glyph drawn and speeds up text drawing by 10% for
relatively large glyphs (probably more for smaller ones).

The qtext::paintLayoutToPixmap() benchmark shows a 16% improvement
in performance with this change.

Renamed the method to glyphData().

Change-Id: I7a353de521e4f4321c770fb1ac6043d33f6f332c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-08-08 11:18:02 +02:00
Tor Arne Vestbø
6ac610c79b Allow specifying explicit SDK version on Apple platforms
This enables building against the latest SDK, while still opting out
of features that this SDK normally enables, by lowering the SDK version
set in the BUILD_VERSION/VERSION_MIN_MACOSX load command.

Change-Id: Id5f13524740bfbf5eda10a5d0c2e3fda04bf3f52
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-08-08 10:27:28 +02:00
Ville Voutilainen
ca20b44959 A GCC 4.8 build fix
Change-Id: Ic128486711118e1124739e8dca30547ab8ba9816
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-08 10:53:53 +03:00
Jason Haslam
4d9375020c macOS: Fix tab button rendering issue
This fixes rendering artifacts for the specific case of the first
unselected vertical (west) tab button in a tab bar. The popup button
gets drawn at the beginning of the tab bar instead of translated to the
actual location of the tab.

Fixes: QTBUG-76385
Change-Id: I17112c56eabacf34e470314d4cc6b263ba632ec1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-08-08 01:38:10 -06:00
Alex Blasche
bab8262bce Minor QSet doc cleanup
C++11 is a requirement since Qt 5.7. There is no point in highlighting
the condition anymore.

Change-Id: I0f7d6044db2528d3b5264c324cf71156ec833775
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-08 07:51:11 +02:00
Eskil Abrahamsen Blomfeldt
a3dec41cf1 Add attribution for AGLFN
We were missing attribution for the AGLFN tables.

Task-number: QTBUG-70968
Change-Id: Ib84cbd25c9f7c49611761c9eba16624de5b77dd2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-08-08 07:07:37 +02:00
Eskil Abrahamsen Blomfeldt
79e0effead Fix crash in QTextDocument::clearUndoRedoStacks()
When calling QTextDocument::clearUndoRedoStacks() with UndoStack,
there were two bugs: The first was that we were retrieving
the item at "undoState" and deleting this. This is actually the
upper limit of the for loop. If the stack does not contain any
redos, then it would be == undoStack.size() and we would assert.

If there were redos, then we would delete the item at undoState
multiple times (actually undoState times).

In addition, when the loop exited, we first removed the dangling
pointers using remove() and then there was a weird resize() to
the new size minus the old undoState.

This would either assert because we tried to resize to a negative
number, or it would arbitrarily remove items from the stack.

[ChangeLog][QtGui][Text] Fixed a crash bug in
QTextDocument::clearUndoRedoStacks(QTextDocument::UndoStack).

Task-number: QTBUG-69546
Change-Id: I8a93e828ec27970763a2756071fa0b01678d2dcd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-08-08 07:07:20 +02:00
Eskil Abrahamsen Blomfeldt
1880fba971 Android: Fix QMenu on 64 bit
The platform menu tags in Qt are actually the pointers, so they are
64-bit values when the build is 64 bit. Since menu IDs in Android
are 32-bit ints, we cannot cast back and forth like we do. To fix
this, we add a separate hash of menu IDs to allow mapping between
Java and C++. For easier book-keeping, we add the hashes to the
menu bar and menu classes, so that we can easily recycle old menu
IDs when they are no longer in use.

Note that overriding the tag on the menus by calling setTag() will
not work, since Qt Widgets will later override it again by setting
it back to the menu's pointer.

[ChangeLog][Android] Fixed an issue where menus would not work on
64 bit builds.

Task-number: QTBUG-76036
Change-Id: Icaa1d235d4166331669139251656ea0159e85195
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2019-08-08 07:06:05 +02:00
Nils Jeisecke
4c2587b6bc QTextDocumentLayout: Refactor pagination logic for borders
The new helper class BorderPaginator encapsulates the existing pagination
logic for drawing correctly clipped borders on all pages a cell appears
on.

This will allow reuse of that logic for drawing CSS-style borders.

Change-Id: I47ed4a8802513aef30d97f14591c7d4716bfdbb8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-08-08 05:52:11 +02:00
Qt Forward Merge Bot
7b5138da16 Merge "Merge remote-tracking branch 'origin/5.12' into 5.13" 2019-08-08 01:00:21 +02:00
Qt Forward Merge Bot
2b38408cbc Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I4c0fd501db974fb8339944b8df845336776d80a9
2019-08-08 01:00:08 +02:00
Nils Jeisecke
81554aca81 QTextDocumentLayout: Fix regression in table column width calculation
87748cc18e introduces rounding of column
widths to avoid table border render artifacts.

For variable columns we must make sure that the maxWidth (= unwrapped
content width) is not rounded down as this can cause erroneous
wrapping of the content at rendering time.

Fixes: QTBUG-43589
Change-Id: Iee155702a12374116a63050e5025df91f097a8e4
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2019-08-07 22:15:04 +02:00
Marc Mutz
80179e3b7e Port users of QDBusAbstractInterface::(async)callWithArgumentList() to new variadic (async)Call()
Except in the auto-generated files.

Required to add a cast operator from QDBusObjectPath to QVariant, as the
variadic call() uses QVariant(arg) instead of QVariant::fromValue(arg).

[ChangeLog][QtDBus][QDBusObjectPath] Added explicit cast operator to QVariant.

Change-Id: I3f3004f7b9300a6340d27488f5b97981cbab3c24
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-08-07 20:09:17 +00:00
Marc Mutz
5f1f0fe0b7 QDateTimePrivate: inherit QSharedData and other cleanups
Don't manage the ref-count yourself, as this requires the code to use
the QAtomic copy ctor, which we want to remove going forward. Using
QSharedData, we can let the compiler write the code for us.

Since 'ref' this way moves to the first spot in the list of effective
members, creating a 4B hole between itself and 'msecs', swap 'status'
and 'msecs' to fill the hole:

  offset:   0       8      16      24
            |       |       |       |
  without   v       v       v       v
  adj.mnt: |*R*|   | msecs | S | U | TZ....
  before:  | msecs | S | U |*R*|   | TZ...
  after:   |*R*| S | msecs | U |   | TZ....

This keeps the padding out of the critical first word, which improves
latency. That said, for accessing the members the old layout surely was
optimal. This layout optimizes copies and pessimizes access to 'msecs'
on 32-bit platforms without the Critical Word First optimization.

Requires adjustments to tst_toolsupport and the qhooks version.

Also default members using NSDMI, consequently drop the manual default
ctor.

Change-Id: I3c48e68694ad29b28a13aa47ea0f283fae52edd7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-08-07 20:09:13 +00:00
Marc Mutz
213f7d1b1f Require opt-out for using QLinkedList
Now that all QLinkedList uses are removed from Qt, make sure
QT_NO_LINKED_LIST is set by default for Qt modules, so new
modules don't need to explicitly specify it in their
.qmake.conf.

Modules can still opt out of the QLinkedList ban by adding
   DEFINES -= QT_NO_LINKED_LIST
to their .qmake.conf.

Change-Id: I34b7ab1c009795649bb7b4f1e7493556eafadd5a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-08-07 20:09:10 +00:00
Marc Mutz
1563c38a4b QPoint/F: add transposed()
For symmetry with QSize and QRect and because there were some users in Qt.

Port those users.

[ChangeLog][QtCore][QPoint/QPointF] Added transposed().

Change-Id: If4f23dbcf7d67983a6b1885e0d1d538115b49e2b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-08-07 23:09:06 +03:00
Marc Mutz
247ab241c7 QVector/QList/QLinkedList/QVarLengthArray/QSet: add missing deduction guides
Amends 2e1763d83a.

The new range ctors need deduction guides, since the compiler can't
deduce the value_type from a pair of iterators.

Change-Id: I3ec1e5f91305b317c443b6a70246be416b55bad9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-08-07 23:09:03 +03:00
Kyle Edwards
bf99c4bf55 CMake: Fix some failing cmake tests
Change-Id: I74f2bf270726feba8367ea222a3c669110c99e08
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-07 22:08:59 +02:00
Volker Hilsheimer
739b3bfb2f Unify and simplify the QHostInfo::lookupHost overloads
The three cases - with classic slot, with functor and context object,
and with lambda - are all doing the same work, they just differ in
how they signal the application code about the results.

The detour through an explicitly posted QMetaCallEvent is needed
if we have a functor or lambda; making sure that the temporary
QHostInfoResult object lives in the right thread guarantees that the
event is received in the correct thread, so we can directly call the
functor (as long as the context object is still alive).

Since we guarantee that the QHostInfoResult object lives in the
thread of the receiver, we can simply emit the signal for old-style
signal/slot connections; the regular signal/slot mechanism will do
the work for us.

Change-Id: I584df17df879af01c653e354490c4691dbedd3fa
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-08-07 22:08:55 +02:00
Laszlo Agocs
d468978d50 rhi: Print the type of the resources in the leak check
Also clarify what this check includes (backends are expected to
register only QRhiResource instances that actually own native
graphics objects - the ones that don't are not included in the
leak checking)

Change-Id: If0f43b302b148f043391fa7fd7bb77cfc8d93b79
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2019-08-07 22:08:52 +02:00
Timur Pocheptsov
36cc171b93 tst_http2::connectToHost - fix flakiness
some assumptions were incorrect: our test server immediately sends
its SETTINGS frame, as a result we have to reply with client preface +
SETTINGS(ACK). So QVERIFY(!prefaceOK) was wrong from the beginning and
was only passing by pure luck.

Change-Id: Ie43f0d4ac41deb0e5339badaae6149a9b2f9d9b3
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-07 18:57:31 +02:00
Laszlo Agocs
53a6f7b783 eglfs: Fix raster windows
Also sanitize the initial WebAssembly hack. Both eglfs and wasm lack the concept
of true raster windows. A QWindow with RasterSurface is rendered with OpenGL
no matter what. The two platforms took two different approaches to work around
the rest of the machinery:

- wasm disabled the QOpenGLContext warning for non-OpenGL QWindows,

- eglfs forced the QWindow surfaceType to OpenGLSurface whenever it was
  originally set to RasterSurface.

Now, the latter breaks since c4e9eabc30, leaving
all raster window applications failing on eglfs, because flush in the backingstore
is now checking the surface type and disallows OpenGLSurface windows. (just like
how QOpenGLContext disallows RasterSurface windows)

To solve all this correctly, introduce a new platform capability,
OpenGLOnRasterSurface, and remove the special handling in the platform plugins.

Change-Id: I7785dfb1c955577bbdccdc14ebaaac5babdec57c
Fixes: QTBUG-77100
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-08-07 11:46:19 +00:00
Tor Arne Vestbø
fccb519809 Don't rely on QWidget::internalWinId in QWidgetBackingStore
QWidget does not handle QWindow and QPlatformWindow being destroyed
behind its back, and the QWidget state for internalWinId and the
Qt::WA_WState_Created attribute can easily get out of sync with
reality.

To avoid QWidgetBackingStore mistakenly thinking that a widget does
not have a platform window it can operate on we use the QWindow and
QPlatformWindow handles directly, instead of relying on the winId.

This is a stop gap until we can teach QWidget to deal with dynamic
changes to its underlying window handles.

Change-Id: Ib09bea2ad62c42e9667a20ca6b5faf0f957288da
Fixes: QTBUG-74559
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-08-07 13:45:34 +02:00
Andreas Hartmetz
0ea7360eaa Fix two examples in QUrl::toLocalFile() documentation
Change-Id: Ib17844e1dd696a41815bdf58924ff40d684884a8
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2019-08-07 12:56:58 +02:00
Edward Welbourne
eab533ae0d Simplify QDate::weekNumber() by looking at the right day of the week
The Thursday in the same week has the same week-number and determines
the right year to use for the week. So calculate its week-number and
save a whole lot of complications.

Change-Id: I9c28267e6083afdd04a15245e1609c64beb82b37
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-08-07 10:28:06 +02:00
Thiago Macieira
3183e428a9 Mark QDBusError::ErrorType a Q_ENUM
Easier qDebugging.

Fixes: QTBUG-77183
Change-Id: Ife213d861bb14c1787e1fffd15b63a1f8d64cc30
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-08-05 20:41:51 -07:00
Marc Mutz
787e498487 QMutexPool: fix memory order of atomic operations
The array of QAtomicPointer<QMutex> can be initialized using relaxed
stores of nullptr, since nullptr is the whole data. But once we store
an actual QMutex pointer in the array, we need to publish the indirect
data thus created. We did this, with testAndSetRelease(); what was
missing was a corresponding acquire fence on load, without which there
is no happens-before relationship between the writes performed by the
QMutex ctor and the reads performed by a subsequent mutex.lock(), say,
on the same data.

Fix by adding acquire fences to all loads. That includes the dtor,
since mutexes may have been created in different threads, and never
been imported into this_thread before the dtor is running.

As a drive-by, return a new'ed QMutex that was successfully installed
directly to the caller, without again going through a load-acquire.

Fixes: QTBUG-59164
Change-Id: Ia25d205b1127c8c4de0979cef997d1a88123c5c3
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 65b8f59e04)
(cherry picked from commit da38f0d691d9d7eacfac5fbcbd47b887bd59bd39)
2019-08-05 19:30:37 +00:00
Thiago Macieira
64d9492076 Fix race condition on qt_create_tls() on Windows
If this function is called by multiple threads, more than one could
reach the mutex locking and call TlsAlloc(), but only the last one would
save the data. The others would be leaked and, worse, be used by those
other threads.

[ChangeLog][QtCore][QObject] Fixed a resource leak caused by a race
condition if multiple QObjects were created at the same time, for the
first time in an application, from multiple threads (implies threads not
started with QThread).

Fixes: QTBUG-77238
Change-Id: Ife213d861bb14c1787e1fffd15b63a5818bcc807
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2019-08-05 10:14:47 -07:00
Thiago Macieira
bbff70181f QTest: add toString(QBitArray)
Change-Id: Ife213d861bb14c1787e1fffd15b70598cda8baf3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-08-05 09:29:27 -07:00
Ville Voutilainen
4f116f00fc Fix GCC 4.8 build
Change-Id: I4994146b359e8e37f6c0fa1b27f03fb9e800fdd5
Fixes: QTBUG-77218
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-05 15:50:42 +03:00
Sona Kurazyan
19a9d3517b Remove the unused includes for QSignalMapper
Change-Id: I13f19fadc7ad3fed8eb0a6718244cc8880e91be9
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-08-05 10:15:57 +02:00
Liang Qi
f3c816befe Merge "Merge remote-tracking branch 'origin/5.12' into 5.13" 2019-08-05 10:03:24 +02:00
Liang Qi
f3b28e8021 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	qmake/generators/unix/unixmake2.cpp
	src/plugins/platforms/cocoa/qcocoawindow.mm

Change-Id: Iba7aa7324f35543e0297a3680956420058cd3630
2019-08-05 09:28:48 +02:00
Joerg Bornemann
8c0787cfa1 Fix dependency_libs entry of .la files
Libtool cannot cope with absolute paths in the dependency_libs entry.
We split absolute paths into -L and -l here.

Change-Id: I30bf11e490d1993d2a4d88c114e07bbae12def6d
Fixes: QTBUG-76625
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-08-03 21:47:55 +02:00