Commit Graph

50800 Commits

Author SHA1 Message Date
Joerg Bornemann
94d5c1bfe0 Merge "Remove win32_system_libs feature from src/corelib/configure.json" 2021-03-04 11:26:42 +00:00
Kai Köhne
52f99ff3d2 Merge "headersclean: Compile with -std=c++latest, -Zc:__cplusplus on MSVC" 2021-03-04 11:11:36 +00:00
Alexey Edelev
6e5e8016dd Fix build of Core module without regularexpression feature
qregularexpression.h requires FEATURE_regularexpression to be enabled.
Add a condition to the 'qt_pch.h' header to fix the build when PCH
are enabled and FEATURE_regularexpression is disabled.

It seems that the filter implementation of QSortFilterProxyModel
has QRegularExpression as its base. It's necessary to make
sortfilterproxymodel dependent on the regularexpression feature.

Fix the precompiler condition for the extractSections function in
the QString implementation. Use the same precompiler condition for
the QString::section and extractSections functions, since
QString::section depends on extractSections.

Change-Id: I5b775e0842a0aa1a8d47f8dded376bdfcf63b5bf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-04 11:31:36 +01:00
Joerg Bornemann
4b9173e354 Fix QT_HOST_LIBEXECS for cross-builds on Windows
Like for LibraryExecutables, we must default to "bin" on Windows for
HostLibraryExecutables in our generated qconfig.cpp.

Pick-to: 6.1
Fixes: QTBUG-91496
Change-Id: Ib5a4b3b3fd6192bd953e615058b482e67ad19462
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-04 10:31:31 +00:00
Joerg Bornemann
728baba70a Complete the renaming of qt_add_tool to qt_internal_add_tool
Fix the name in the function's doc comment and error messages.

Pick-to: 6.1
Change-Id: I918db802a0dbb0508f65d227f7c896d2ad0beeae
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-04 11:31:21 +01:00
Joerg Bornemann
7b6c526ef1 Fix double inclusion of QtAutoDetect.cmake in top-level build
The variable we need to check is called QT_SUPERBUILD, not
QT_SUPER_BUILD.

Pick-to: 6.1 6.0
Change-Id: I8487f491a0a4cebdf08f579519e99e6afe3db8c2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-04 11:31:14 +01:00
Albert Astals Cid
eeb4c0a1c9 Merge "Fix signature of canDropMimeData used in code snippet" 2021-03-04 10:22:45 +00:00
Andrei Golubev
70bd6bf1e3 Merge "Fix compilation error in QDateTime" 2021-03-04 09:40:01 +00:00
Joerg Bornemann
00b75e86f3 Remove win32_system_libs feature from src/corelib/configure.json
This feature only existed to trigger the evaluation of the libs gdi32,
kernel32 and friends. Those libs only were relevant for the qmake build
of Qt and can be removed now.

Task-number: QTBUG-83932
Change-Id: Idfd4d8f70b6dbd1067412fecc1115b504b1ad347
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-03-04 09:56:09 +01:00
Joerg Bornemann
800f745140 Move syncqt.pl to libexec
To not disturb the qmake build we kept syncqt.pl in <src>/bin but
installed it to libexec. This is not necessary anymore.

This also removes the need for having syncqt.pl in both, bin and libexec
in the build dir of qtbase.

Pick-to: 6.1
Fixes: QTBUG-91076
Change-Id: I44b014ea41e3f00c420e02fd5c76f11169340b8c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-03-04 09:56:07 +01:00
Joerg Bornemann
e01add5cdb Remove fixqt4headers.pl
This script was aiding users to port from Qt 4 to 5 and is considered
to be of little value for Qt 6.

Pick-to: 6.1
Change-Id: I26fb97d32969463d94e38222e32f241f86ad9193
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-03-04 09:56:06 +01:00
Joerg Bornemann
7c62caa355 Make toolchain inspection more robust
QtAutoDetect.cmake did read the (possibly detected) toolchain file and
looked for the string "The Android Open Source Project" to deduce that
we want to build for Android. This has been done, because we're
autodetecting the platform before the first project comment, i.e. before
the toolchain file is loaded.

This magic string detection is a bit fragile, and we need a similar
approach for WebAssembly. A more robust approach would be to fetch the
value of CMAKE_SYSTEM_NAME from the toolchain file without actually
loading it.

Now, we run a CMake script that includes the toolchain file and prints
variables were interested in. The calling code reads these variables and
stores them in prefixed variables in the current scope.

Change-Id: Ide9ea3054e1453d17129523e1ec86ecaed55af2a
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-04 09:55:41 +01:00
Alexey Edelev
1f8f13cbe7 Add the 'FEATURE_qmake' feature
Add a conditional build of the qmake.

Task-number: QTBUG-89369
Change-Id: I8d7968ffb20ea31df2f85fff055e0d131ed06a36
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-04 09:49:44 +01:00
Sona Kurazyan
fcc453df5c Improve docs for Qt Concurrent run with promise mode
For the readers that are new to QtConcurrent, it may be confusing that
unlike the normal usage of QPromise, they don't have to call start() or
finish() when using Qt Concurrent run with promise mode. Be more
explicit about that.

Pick-to: 6.1
Change-Id: I08df6c4ca41bec4120e208a6643ee20c7adf265c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2021-03-04 09:45:31 +01:00
Friedemann Kleint
b62725608b Blacklist test QMenu::QTBUG_89082_actionTipsHide() for Windows
Apparently, ba13960392 is not
sufficient.
Amends 3f3d5e6716.

Pick-to: 6.0 6.1 5.15
Task-number: QTBUG-89082
Change-Id: I80a00abb330bebd3be8667762c279c2eef595c7f
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-03-04 08:43:33 +00:00
Kai Köhne
b58ca067da headersclean: Compile with -std=c++latest, -Zc:__cplusplus on MSVC
c++latest does check that our headers also work with upcoming C++20
support in MSVC. It also implicitly sets -permissive-, which checks for
stricter standards compliance.

Pick-to: 6.1
Task-number: QTBUG-91117
Change-Id: Iaf1547191969213d570a1b2f59888ad04a7977ab
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-04 09:40:56 +01:00
Timur Pocheptsov
7c1aa0c48c Convert QDtls classes to the new plugin-based design
Essentially, the same code re-shuffled and placed behind
the new interfaces.

Fixes: QTBUG-91174
Task-number: QTBUG-65922
Change-Id: I8f14697f10713f9738c5c7805aed0150c084850c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6c835796c8ea2590008900ffb5f4bf0d902ee73d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-04 08:40:07 +00:00
Albert Astals Cid
b22fe78d85 Fix signature of canDropMimeData used in code snippet
Change-Id: I9026e11630651e740282466551ad78883a0421ec
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-04 09:04:17 +01:00
Eirik Aavitsland
ede0082f86 Update bundled libjpeg-turbo to version 2.0.6
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.0.6

Pick-to: 6.1 6.0 5.15 5.12
Change-Id: I3e308d241853edf3c1d616955cda203220a258d8
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-03-04 09:04:02 +01:00
Andrei Golubev
538e9fa568 Fix compilation error in QDateTime
One of the changes done in 902505a058
results in a compilation error: somehow an expression
"int * enum value (with underlying type qint64)" has result type
"long int" and thus the compiler cannot find matching add_overflow

Return the qint64 cast back to overcome this
Compiler: gcc 7.5.0-3ubuntu1~18.04

Change-Id: Iaca882762e812bef69ec325df5f59e02082a0130
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-04 08:26:30 +01:00
Giuseppe D'Angelo
fe9d7bf759 QScopedPointer: deprecate swap
Follow up of 612a01be65
(deprecating QSP::take()): for the same reasons, swap()
functions do not belong to QScopedPointer, or they would
allow the pointer to escape:

  QScopedPointer a;
  {
    QScopedPointer b = ~~~;
    qSwap(a, b);
  }
  // b's pointer escaped its scope

Deprecate them as well.

[ChangeLog][QtCore][QScopedPointer] QScopedPointer swapping
functions have been deprecated, as they would allow the
managed pointer to escape the scope. If you need those semantics,
use std::unique_ptr instead.

Change-Id: I2b0938b62f2ef5a3561f61f595a3fb4c505a8f08
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-04 06:49:02 +01:00
Zou Ya
712117f8b8 Redundant condition: tornoff
Redundant condition: tornoff.
'!tornoff || (tornoff && scroll)' is equivalent to
'!tornoff || scroll'

Pick-to: 6.1
Change-Id: I8339faa4d53360db280173ee489e48eba4883b70
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-03-04 10:34:43 +08:00
Huang Jie
d3ec08eea0 Redundant condition: widget
Redundant condition: widget. '!widget || (widget && widget->isEnabled())'
is equivalent to '!widget || widget->isEnabled()'

Pick-to: 6.1
Change-Id: Ife915bd5ea66f8ccff48a1612f8c78c263075c89
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-03-04 10:33:40 +08:00
Huang Jie
8a226cd76b Variable is Assigned a never used value in qt_make_filter_list()
Variable 'i' is assigned a value that is never used in qt_make_filter_list()

Pick-to: 6.1
Change-Id: Id845ecb5231b97a899443bdcb9f49cccb7f20bea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-03-04 02:33:03 +00:00
Volker Hilsheimer
6e334a85a8 QHostInfo: simplify assignment operator
The d_ptr is never nullptr. If it could be, then other's d_ptr could
also be nullptr, and we would dereference the null pointer.

Guarding against self-assignment is nevertheless a good practice.

Fixes static analyzer warning
5fc3780532e30c6350a0aa1ad2188a4c.

Pick-to: 6.1
Change-Id: I07ff808e4c4f5bf07b4d6663f1fb4a3301a0fec7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-03 23:41:25 +01:00
Volker Hilsheimer
90b51219dd QMetaType::create: don't leak memory if copy can't be made
QMetaType::construct will return nullptr if a copy is requested but
if there is no copy constructor. In that case, the memory allocated in
QMetaType::create will be leaked.

This case is covered in the unit tests in

template<>
void testCreateHelper<QMetaType::Void>()

so we can't assert in construct that a copy constructor is present if
a copy is requested.

Fixes static analyzer warning 618b1e6877f737df57c39fd35ad91cd4.

Pick-to: 6.1
Change-Id: Ic439b36b1f120b9d0f888efaeab2801d8acc13de
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-03 23:41:14 +01:00
Giuseppe D'Angelo
0eca1f4a46 Merge "Port some value classes away from QScopedPointer" 2021-03-03 21:18:38 +00:00
Giuseppe D'Angelo
1086d9a572 Port some value classes away from QScopedPointer
In preparation for deprecation of QScopedPointer::swap, port to
other established solutions:

* QPainterPath was basically a QExplicitlySharedDataPointer
re-engineered around a QScopedPointer. Just use the right class
for the job...

* QBrush is in a similar situation, although its deleter is
more complex; port to unique_ptr for that one to minimize the
code impact.

Change-Id: I7f7c1dd8702f84f5146043347af64dda3c7e6f09
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-03-03 19:36:23 +01:00
Volker Hilsheimer
7b3883614d Initialize out-variable
QMetaType::convert does have code paths where nothing is written to the
'to' out-variable. Those code paths shouldn't run in this particular
case, but it's good practice to initialize out-variables anyway.

Fixes static analyzer warning 1453920f5abe1e30471eca6aa01d22d1.

Change-Id: I6f6d1044759866c405e61cb51147ca0490c4f3a4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-03 19:16:55 +01:00
Timur Pocheptsov
3bf0a40a3b Merge "Convert elliptic curves and DH params to work with QTlsBackend" 2021-03-03 16:17:48 +00:00
Volker Hilsheimer
9a1f2c2461 Merge "Don't access data in moved-from object" 2021-03-03 15:31:17 +00:00
Timur Pocheptsov
ff76599b59 Convert elliptic curves and DH params to work with QTlsBackend
The corresponding API is becoming a part of QTlsBackend interface,
since it's too minimalistic and does not require additional
interfaces, unlike certificates or keys.

Fixes: QTBUG-91177
Fixes: QTBUG-91175
Task-number: QTBUG-65922
Change-Id: I44dd0adbdf2427962451998664efe234d59fae24
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit cdf4976b5a01bc5b65aed746acc9cc7f87b0fd97)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-03-03 14:52:16 +01:00
Paul Wicking
afde5faf85 Doc: Specify correct include for QWGLContext
Pick-to: 6.1 6.0
Fixes: QTBUG-91500
Change-Id: Ie842c9e911fe5492cc13aeba459d28d6553438fd
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2021-03-03 14:51:01 +01:00
Laszlo Agocs
2cfbce4bc6 QOpenGLTexture: Fix typo in enum value
Pick-to: 6.1
Fixes: QTBUG-91431
Change-Id: I59c37de527f53339130216997402f325d0badb12
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-03-03 14:50:59 +01:00
Volker Hilsheimer
4daf83a0dc Don't access data in moved-from object
It's undefined behavior, esp since we leave it to the compiler to
implement a move constructor for the ButtonInfo struct. So read the data
that we need first.

Fixes static analyzer warning
de76eedae524c86f89d6369c0f5af8c7.

Pick-to: 6.1
Change-Id: I8fc458b7e9ba8904ec7a3b1c26aac0628e336ea2
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-03-03 14:12:08 +01:00
Zou Ya
b487a7929d The condition 'if(oldChild)' is redundant
Either the condition 'if(oldChild)' is redundant or there is possible
 null pointer dereference: oldChild.

Pick-to: 6.1
Change-Id: I28971cfa33294679ddd325158669b422b3a1c2eb
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-03-03 20:52:45 +08:00
Kai Köhne
4a037e86d4 Merge "Improve support for QT_ADDITIONAL_PACKAGES_PREFIX_PATH" 2021-03-03 12:19:52 +00:00
JiDe Zhang
b18a845bef Merge "fix: Print a warning message if the Xcb EGL initialize failed" 2021-03-03 11:40:28 +00:00
Kai Köhne
5bbd700124 Improve support for QT_ADDITIONAL_PACKAGES_PREFIX_PATH
Allow to set QT_ADDITIONAL_PACKAGES_PREFIX_PATH as both an env
variable and CMake cache variable. Also normalize path and list
separators, so that they can be used similar to CMAKE_PREFIX_PATH.

The environment variable is intended to be set by the conan virtualenv
generator, so that e.g.

  find_package(Qt6 COMPONENTS NetworkAuth REQUIRED)

also works if NetworkAuth is not installed into the Qt prefix.

Pick-to: 6.1
Fixes: QTBUG-91142
Change-Id: Ia9f9b9fa2b1b051d33073629139640d0f4c7a843
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-03-03 10:21:28 +01:00
Friedemann Kleint
65c6fbea24 Stabilize test QMenu::QTBUG_89082_actionTipsHide() on Windows, take 2
Use the QWindow-based overloads of QTest::mouseMove(), which do
not move the cursor position.

Amends ba13960392,
3f3d5e6716.

Task-number: QTBUG-89082
Pick-to: 6.0 6.1 5.15
Change-Id: I2cc62e4d1f24e4baebafd0d76fbf0fbdb6f588c7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-03 10:16:30 +01:00
Friedemann Kleint
4b15a8ea8f Prospective fix for flaky test tst_QDoubleSpinBox::setReadOnly()
The test has been observed to fail with:

 FAIL!  : tst_QDoubleSpinBox::setReadOnly() 'QTest::qWaitForWindowActive(&spin)' returned FALSE. ()
 /Users/qt/work/qt/qtbase/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp(863) : failure location

Remove the widget member and use a widget instantiated on the stack instead.
Add a check for top level widget leaks in cleanup() and fix leaking task224497_fltMax()
by instantiating the widget  on the stack.

Pick-to: 6.1
Change-Id: Idbbb5d859c0df2d9b9f49fb9f69ef6bb7d1ee150
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-03-03 10:16:22 +01:00
JiDe Zhang
cc7911beb1 fix: Print a warning message if the Xcb EGL initialize failed
Before, No matter what the value of "success" is, Will print
the "Xcb EGL gl-integration successfully initialized".
If egl initialization fails, this line of printing will be very
confusing.

Change-Id: I6a06e2c14372913823c56ffe2fd8b831e084c719
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-03-03 17:10:06 +08:00
Volker Hilsheimer
d984fd13ad QGraphicsWidget: don't dereference nullptr
Unlikely that one item is nullptr and the other item doesn't have a
scene, but we do already test for the scene pointer, so don't continue
if it's nullptr.

Fixes static analyzer warning f59576ecf6618447c4f9c7be93fc737f

Pick-to: 6.1
Change-Id: I6d436bb1211ddd412821d6978bab25192033f5e5
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-03-03 10:00:30 +01:00
Volker Hilsheimer
95e34f7fbc QGraphicsWidget: Check for nullptrs in focus chain handling
The while loops terminate if focusAfter becomes nullptr (unless we break
earlier), so don't dereference those pointers without checking first.

Fixes static analzyer warnings 979f2d508db4d5838f6c9b296120ce60 and
481f2ec7b5851bf19414478428f944b7

Pick-to: 6.1
Change-Id: I60fc5999907fe3b3146d7047ee1eff197719ab31
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-03-03 10:00:27 +01:00
Volker Hilsheimer
98db996576 Add nullptr checks to QGraphicsView classes
The styleInfo parameter defaults to nullptr, and the scene can evidently
be nullptr since we test for it before ungrabbing the mouse.

Fixes static analyzer warnings
fbd03604cc701651595a2ea33c5562b4 and
30fcb05194f3a2d121fc57b05e0ccf10

Pick-to: 6.1
Change-Id: I8e9d4fe4055115c366ada1cbb22a8f0839ba41da
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-03-03 10:00:22 +01:00
Ville Voutilainen
6e0ce4ee80 Android: make calling exit() conditional on an environment variable
Task-number: QTBUG-82617
Task-number: QTBUG-85449
Task-number: QTBUG-83043
Change-Id: I5ac67b5d57550e5a1f816e5db01f4aab31127283
Pick-to: 5.15
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-03-03 08:18:41 +00:00
Joerg Bornemann
b1ad7f938e Generate information about user-facing applications in build dir
When packaging different Qt versions for Linux distributions (or any
distribution with a common bin dir), Qt tools cannot be installed to
/usr/bin, because the executable names of the different Qt versions
clash.

To solve this conflict, our recommendation is to install Qt's tools to
/usr/lib/qt6/bin and to create versioned symlinks to user-facing tools
in /usr/bin.

User-facing tools are tools that are supposed to be started manually by
the user. They are marked in Qt's build system. Distro package
maintainers can now configure with
  -DCMAKE_INSTALL_PREFIX=/usr
  -DINSTALL_BINDIR=/usr/lib/qt6/bin
  -DINSTALL_PUBLICBINDIR=/usr/bin
and will find a file called user_facing_tool_links.txt in the build
directory after the cmake run. Nothing will be installed to
INSTALL_PUBLICBINDIR.

Each line of user_facing_tool_links.txt consists of the installation
path of a user-facing application followed by a space and the versioned
link name in INSTALL_PUBLICBINDIR.

Example content:
/usr/lib/qt6/bin/qmake /usr/bin/qmake6

To actually create the versioned symlinks, the content of this file can
be fed to ln like this:
  xargs ln -s < build-dir/user_facing_tool_links.txt

Or the package maintainer may decide to do something completely
different as suits their needs.

This patch adds the USER_FACING argument to qt_internal_add_tool to mark
tools as user-facing. In addition, every Qt created by
qt_internal_add_app is treated as user-facing.

The only tool this patch marks as user-facing in qtbase is qmake.

Pick-to: 6.1
Fixes: QTBUG-89170
Change-Id: I52673b1c8d40f40f56a74203065553115e2c4de5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-03-02 22:00:51 +01:00
Alex Trotsenko
f265c87e01 Allow QWindowsPipe{Reader|Writer} to work with foreign event loops, take 2
When a foreign event loop that does not enter an alertable wait state
is running (which is also the case when a native dialog window is
modal), pipe handlers would freeze temporarily due to their APC
callbacks not being invoked.

We address this problem by moving the I/O callbacks to the Windows
thread pool, and only posting completion events to the main loop
from there. That makes the actual I/O completely independent from
any main loop, while the signal delivery works also with foreign
loops (because Qt event delivery uses Windows messages, which foreign
loops typically handle correctly).

As a nice side effect, performance (and in particular scalability)
is improved.

Several other approaches have been tried:
1) Using QWinEventNotifier was about a quarter slower and scaled much
   worse. Additionally, it also required a rather egregious hack to
   handle the (pathological) case of a single thread talking to both
   ends of a QLocalSocket synchronously.
2) Queuing APCs from the thread pool to the main thread and also
   posting wake-up events to its event loop, and handling I/O on the
   main thread; this performed roughly like this solution, but scaled
   half as well, and the separate wake-up path was still deemed hacky.
3) Only posting wake-up events to the main thread from the thread pool,
   and still handling I/O on the main thread; this still performed
   comparably to 2), and the pathological case was not handled at all.
4) Using this approach for reads and that of 3) for writes was slightly
   faster with big amounts of data, but scaled slightly worse, and the
   diverging implementations were deemed not desirable.

Fixes: QTBUG-64443
Change-Id: I66443c3021d6ba98639a214c3e768be97d2cf14b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-03-02 22:53:06 +02:00
Timur Pocheptsov
d316ae8e83 QSsl: fix UB pointer use
Weird macro had inverted notion of type safety: instead of casting
parameters and return values (they are pointers) to work with generic
OPENSSL_sk_xxx functions, it was ... casting a function pointer to an invalid
type to get ... nothing, but UB. Home-brewed (un)'safestack'!!!

Change-Id: Ib91a7ba4cd472f370836797e422456f91a4385b0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 9fc2f1f076b953ff0979fb73ed6e70ac9bde278c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-02 18:03:54 +00:00
Timur Pocheptsov
79138e41d6 Move QSslCertificate's details and cert-related code to the plugins
Also since we have to properly support 'no-ssl' configure option
(alas, we support QSslCertificate on such builds) - introduce
a minimal crippled QTlsBackendCertOnly, which depends on
X509CertificateGeneric.

Fixes: QTBUG-90954
Task-number: QTBUG-65922
Change-Id: Ib9d62903f16b7c0eaaa23e319a822c24a7631dc6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 41fc143635c25f937a557f09890601f6c7d38736)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-02 18:03:00 +00:00