Commit Graph

59821 Commits

Author SHA1 Message Date
Mårten Nordheim
5006fddd33 HTTP Example: Add proxy handling
If a proxy is configured on the system then we will request credentials
if needed.

Task-number: QTBUG-108874
Fixes: QTBUG-106245
Pick-to: 6.5
Change-Id: Icbea491492cde4634421b1a1e722a3768d56dec8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-01-24 20:11:53 +01:00
Mårten Nordheim
d18b5195c1 HTTP example: remove needlessly unset-ing window flag
In Qt 6 it is unset by default.

Task-number: QTBUG-108874
Pick-to: 6.5
Change-Id: I35af9d7c1517fd393710b7b1b978d3f39c61acf0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-01-24 20:11:53 +01:00
Mårten Nordheim
c89c37b52f HTTP example: Fix missing translation and improve others
As a drive-by: print the path with native separators

Task-number: QTBUG-108874
Pick-to: 6.5
Change-Id: I73164acb159d1a45960e16d5f57996e8c27257f7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-01-24 20:11:53 +01:00
Mårten Nordheim
7c90881a8e HTTP example: rename to HTTP Client
It can do more than HTTP but let's keep the naming simple. Most people
likely aren't looking to do file: or data: or qrc: in this example.

Task-number: QTBUG-108874
Pick-to: 6.5
Change-Id: I8a822640f4a8015ebf6c56cb6a614d6426e8a912
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-01-24 20:11:53 +01:00
Mårten Nordheim
5bc644c951 Fortune* Example: Rename and add category/tags
Task-number: QTBUG-108875
Pick-to: 6.5
Change-Id: I8eeff88187be4f85514d9871eb5009c51ad6de64
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-01-24 20:11:53 +01:00
Sze Howe Koh
a97dbbd1a0 Doc: Fix usages of deleted QVariant constructors
Finish the job started at 879d30394a

Pick-to: 6.5 6.4 6.2
Change-Id: I217a4830ac8e17d5d1f8900e2d3134fbabf8b9a2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-25 02:48:15 +08:00
Edward Welbourne
10117f78d7 Restore Android-conditioning on nl_langinfo() definition
QCoreApplicationPrivate::initLocale()'s check that the selected locale
is UTF-8-based was added with an initial work-around for Android,
specific to NDK <= 15, which Qt 5.15 did not support.

Later the Android-specific #if-ery was changed to test for Qt taking
UTF-8 for granted, for a given reason having to do with QNX; and later
the #if-ery for that was removed. However, we still support versions
of Android that lack nl_langinfo(), so restore the Android #if-ery.
It presently seems that NDK 26 (Android 8) does contain nl_langinfo(),
so we should be able to drop the nl_langinfo() kludge for this and
later versions. That way we'll at least use the real nl_langinfo()
where we have it.

In the process, fix the indentation of #if-ery.

Pick-to: 6.5 6.4 6.2
Change-Id: Ie9e83c3397955c24cea1e9a9ff6bb0187e47dda2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-01-24 19:48:15 +01:00
Edward Welbourne
1cd7bdeceb Decode file-name to pass as QString to QFile::exists()
QSharedMemorySystemV::updateNativeKeyFile() stores the QBA
nativeKeyFile member using QFile::encodeName(), so feed it back
through QFile::decodeName() rather than relying on QString(QByteArray)
coercion, which might use a different encoding.
Fixes a CodeChecker grumble.

Change-Id: If9fb01ed65b5bba8c1070b4939ee1d87adf94743
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-01-24 19:48:15 +01:00
Edward Welbourne
7d45117571 Cast away [[nodiscard]] values in runtime support checks
Test calls in Q{SystemSemaphore,SharedMemory}*::runtimeSupportCheck()
are commented to be sure to fail, so the return is irrelevant.
Suppresses warnings from CodeChecker.

Change-Id: I2ac6ccb8d96a169229dcf24a744015fb9d414c74
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-01-24 19:48:15 +01:00
Edward Welbourne
372dc4c6a1 Fix bash-ism in configure; /bin/sh doesn't handle +=
The script claims to be #!/bin/sh so should not use bash extensions.

Amends 5c40cb0f1a.

Change-Id: Ib88f528acda0893fd6e96878c49ec5a2cf7ebba7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-24 18:48:15 +00:00
Joerg Bornemann
854986836a Fix configure -no-rpath for CMake < 3.18
We must not set rpath-related properties on INTERFACE libraries. Move
the code that sets the properties below the bail out for INTERFACE
libraries.

This amends commit 392d9a5419.

Pick-to: 6.5
Fixes: QTBUG-110513
Change-Id: Ie395f1482245c4522917f982d2f3bc745c0b2abc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-01-24 18:54:58 +01:00
Ahmad Samir
3027e49893 QDateTimeParser: don't shadow member variable
Rename local var to lastVal, this is less confusing and less error
prone. Seeing "last" in the code one would have to ask which one it is,
the member var, a parameter or a local var? and it could be missed
especially when reading code quickly, which happens especially if it's
not what you're focusing on now, i.e. you're fixing something else and
want to check this code quickly.

Change-Id: Id1742fd5f47ce65faf4d95f408ab3eb1f16e8c45
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-01-24 19:54:58 +02:00
Assam Boudjelthia
b49e2bb084 Android: add build dirs/files of Android templates to .gitignore
Those files/dirs are only build time generated by IDEs like Android
Studio or gradle builds, so ignore them.

Pick-to: 6.5 6.4 6.2
Change-Id: Ib4785f9cc75412825d5be4cb5fe206587f37d193
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-24 17:01:05 +02:00
Laszlo Agocs
3bad6d5970 QOpenGLContext: Handle versionFunctions like other data
While probably not common, it is not unthinkable that one does
a destroy() - create() on a QOpenGLContext while relying on the
versioned function wrappers. This is likely broken at the moment
since the internal data is not released on destroy(), only when
the QOpenGLContext is deleted. This differs from any other similar
data (the portable function resolvers, QOpenGLTexture backing data,
etc.) which are all dropped and nulled out in destroy().

Also remove the bizarre comment in the dtor which must be something
from Qt 4 / QGLWidget times.

Note that this does not fix the associated problem since that only
relies on the standard mechanism that leads to fully destroying
and then recreating the QOpenGLContext when the window changes.

Pick-to: 6.5
Task-number: QTBUG-109171
Change-Id: Id265a1d208ffae3792a0608c29324e840ce690dc
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-01-24 16:01:05 +01:00
Laszlo Agocs
f045ef4ab6 Sanitize the order of things in QOpenGLContext destroy()
Amends e08fe78b2335046934abae970e59fe0156178b95 (in a way).

While touching this function in the other patch, it becomes
obvious that the order in which things are cleaned up and
invalidated is somewhat odd: the native context is in fact
gone _before_ invoking helper callbacks or tearing down the
OpenGL API wrappers. This only works because likely nothing
relies on the context still being usable when destroying
those objects and when the texture/vao helper callbacks
run.

Reorder this to: 1. emit the about-to signal 2. invoke
callbacks and null out helpers 3. destroy the function
resolvers 4. only then start tearing down the platform
(and so the underlying native) context objects.

Pick-to: 6.5
Change-Id: I9067463b8f6ce1f656129594c347c1428439ca5e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2023-01-24 16:01:05 +01:00
Antti Määttä
f766e60519 CTF: Fix static constant types and names
- Convert defines to static const
- Use camel case in the constants
- Use size_t as type in sizes.

Pick-to: 6.5
Change-Id: I06d2588bfa5211a7825f068b2c4f33bbbd2065c4
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
2023-01-24 16:13:41 +02:00
Nicholas Bennett
a0ca5f433f Docs:Android: Add docs notes about support for content Uris
Add some details about the support of Qt apis (QFile, QDir, QFileInfo)
for Android content uris.

Fixes: QTBUG-99664
Task-number: QTBUG-98974
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I4b884623702ccad116d47049e34ccddfe21f83ca
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2023-01-24 11:10:30 +00:00
Eirik Aavitsland
b44f222dbe Support the scaling factor of some Windows pdf print devices
The printer drivers of some pdf printers allows the user to set a
global scaling factor, scaling up or down the number of device pixels
available for the same paper size and dpi. Make sure to update the Qt
print device metrics accordingly so that QPainter will see the entire
page, and not more than the page.

Fixes: QTBUG-106659
Pick-to: 6.5
Change-Id: Icb90c1aa742f56b2a2043ef7070530beebe541d5
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-01-24 11:00:16 +00:00
Mikolaj Boc
025659a18c wasm testrunner: Join output into batches
Sending each line in separate POST requests seems to clog emrun.
Join the output in 300ms intervals so that the number of requests is
limited to 3,(3) per second.

Fixes: QTBUG-109827
Change-Id: I099e8cc14d9d162c54b7040b62297d1070b234c3
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
2023-01-24 08:34:42 +01:00
Amir Masoud Abdol
897579edab Remove the extra quote, now that we use cmake_parse_arguments(PARSE_ARGV
The extra quote enforces the arguments to be string, and stops the
COMMAND_EXPAND_LISTS within
QtDbusHelpers.cmake::qt_create_qdbusxml2cpp_command from expanding it
as a list.

Fixes: QTBUG-110459
Fixes: QTBUG-110450
Task-number: QTBUG-99238
Change-Id: Ifddd6570c7bf8f2d1757f275d9445ce2924a93f1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-01-23 20:21:10 +01:00
Friedemann Kleint
97a7e7b2d0 uic: Refactor options parsing
- Use modern string literals and initializer lists
- Move the Python-specific parts into if block

Pick-to: 6.5
Task-number: PYSIDE-2191
Change-Id: I529f461b330de72dba465ece2c03fa55819a575e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-01-23 19:25:06 +01:00
Tor Arne Vestbø
457300ff60 permissions: Don't try to read usage descriptions from non-existing plist
Task-number: QTBUG-110356
Pick-to: 6.5
Change-Id: I8078556fbe67e98af2fcfe8222a8ce097df69f08
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-01-23 19:25:06 +01:00
Oliver Wolff
b2c1237b45 Introduce qt_winrtbase_p.h
Due to a bug in earlier Windows SDKs developers have copy paste
a workaround whenever they are including winrt/base.h. In addition to
that our usage winrt API also forces them to include
qfactorycacheregistration_p.h whenever they include that file. To make
things easier all that magic can now be done with one single include of
qt_winrtbase_p.h.

Pick-to: 6.4
Change-Id: Ic6a80d6d3723af381cf0ecc0f0ab43c2e6839a7d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-01-23 18:53:34 +01:00
Andreas Eliasson
76ecff6aeb Doc: Only list qt core classes in qt core io group
The group page for Qt core classes related to I/O include classes from
other modules. Remove these classes from the group; it may confuse
the reader.

Fixes: QTBUG-110020
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: If7df85523ce6b3aa09605bd89d9899ce308d2671
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-01-23 17:50:51 +01:00
Yuhang Zhao
17ab11ce49 Windows QPA: also consider window flags when judging frameless or not
It's possible that the window has the WS_THICKFRAME flag but the
Qt::FramelessWindowHint is enabled at the same time. That usually
indicates the user is customizing the window, but it will also
confuse QPA's current logic. We can make the logic more roboust
by reading the Qt window flags as well.

Pick-to: 6.5 6.4
Change-Id: I9894e312a92ef7f5fc0aa93974f216b67fe2cf29
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-01-23 23:39:16 +08:00
Yuhang Zhao
5e0d9a077d Windows QPA: rework how we set dpi awareness
Qt6's minimum supported platform is Win10 1809, so it should be quite
safe to use DPI_AWARENESS_CONTEXT APIs because they were introduced
in Win10 1607.

This patch removes the use of the PROCESS_DPI_AWARENESS APIs because
they are old (introduced in Win8.1) and most importantly, they can't
handle the new PMv2 and GdiScaled awareness mode.

This refactor also fixed a bug: previously Qt is using GetProcessDpiAwareness()
to get the dpi awareness mode of the current process, however, that API can't
return PMv2, which means even if we are in PMv2 mode, it will still return PMv1
(I've confirmed that locally), and thus Qt is mishandling such cases.
Eg: when judging whether to enable non-client area dpi scaling or not.

Change-Id: I8a8946ba63c863f8c19c27998af2bac97db37ec7
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-01-23 23:39:16 +08:00
Yuhang Zhao
21baa76230 windeployqt: a little readability improvement
Break the long sentence to improve the logic readability a bit.

Pick-to: 6.5
Change-Id: I3d0227e616a3c47e14ae7b5cfe4b47a39d778e5e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-01-23 16:39:16 +01:00
Antti Määttä
86398b477b CTF: Remove irrelevant comment
Remove comment about lttng not relevant to ctf backend.

Pick-to: 6.5
Change-Id: I4d4432b1075a27d024db38a3cdd7807a1e94e7ec
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
2023-01-23 17:39:16 +02:00
Assam Boudjelthia
63f9da73b5 Android: bump minimum sdk build version QT_ANDROID_API_VERSION to 33
To allow using Android 13 APIs.

Pick-to: 6.5
Change-Id: Ic805f1e0500ce9dee25ba28fb4ef65c7afacad65
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-23 15:39:16 +00:00
Jani Heikkinen
2fa21f4821 Revert "Revert "Add binary compatibility file generated against 6.4.0""
This reverts commit cebcb7991a.

Reason for revert: We need to enable BIC tests again

Pick-to: 6.5
Change-Id: Ibabe2c50547972d040d933a1027833426b018e81
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-01-23 14:51:55 +00:00
Giuseppe D'Angelo
baa5888807 Windows: use MSG timestamps for input events
Input events have a timestamp. When dispatching an event through QPA, a
platform plugin can either provide it, or QPA will use an internal
QElapsedTimer to provide a timestamp.

Windows input messages do come with a timestamp already, so we can use
that instead of the QPA.

The two methods are not equivalent.

For instance: for various reasons, Qt does not honor Windows' "double
clicked" message, but uses the delta between two mouse events to
establish if the second click is actually a double click.

Now suppose that the user double clicks on a widget. On the first click,
the application does something that freezes it for a bit (e.g. some
heavy repainting or whatever). Does the second click register as a
double click or not?

* If we're using Qt's own timer, the answer is NO; the event is pulled
  from the WM queue after the freeze, given a timestamp far away from
  the last click, and so it will be deemed another single click
* If we use the OS' timestamps, then the second click will be seen as
  "close" to the first click, and correctly registered as second click.

This reasoning can be extended to many other QPA events, but looks like
the APIs for some are missing (e.g. enter events), so I'm not tackling
them here.

Task-number: QTBUG-109833
Change-Id: I149361a844feac86cafa885c109a1903b1e49545
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-01-23 15:51:55 +01:00
Giuseppe D'Angelo
3d8e02152a Windows QPA: use make_unique instead of QSP+raw new+memset
A minimal change here would've been just to use value initialization
instead of default initialization. But just go for the kill -- stop
using QScopedPointer.

Change-Id: Ie427a44d13987c2b4a2c881c350df04e935df9d8
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2023-01-23 15:51:55 +01:00
Marc Mutz
c155216917 qcompilerdetection.h: add Q_COMPILER_MANGLES_ACCESS_SPECIFIER
This is similar to Q_COMPILER_MANGLES_RETURN_TYPE, except that the
other such compiler, SunPro CC, at least by my cursory reading of

https://archive.org/download/SunWorkshopVol5No1/Sun%20WorkShop%E2%84%A2%20for%20Solaris%202.x%20Volume%205%20Number%201.iso/SPROmrcpl%2Freloc%2FSUNWspro%2FSC4.2%2FREADMEs%2Fmangling.ps

doesn't appear to mangle the access specifier. So it's only MSVC. It's
still better to have a properly-named macro for this than to work with
Q_CC_MSVC and, hopefully, an explanatory code comment.

May come in handy to maintain BC when we find the need to change an
access specifier in the future. The original use-case, in QtPositioning,
was fixed differently. If nothing else, let's have it to raise awareness
of the issue.

Pick-to: 6.5
Change-Id: Ia8b789d2713ec19487a21c6bb0a12cf285e6ba83
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-01-23 14:51:55 +00:00
Marc Mutz
01ef951c65 QString: port toUcs4_helper() to char16_t/char32_t
This gets rid of 50% of the casts required to call the function, and
removes the last QtCore QStringView(ushort*) user.

As a drive-by, replace an (allowed, but) fishy &str[0] with
str.data(), the mutable overload of which has been available since
C++17.

Task-number: QTBUG-110403
Change-Id: Iad494025b61c53d991e59cc73198bb014a422a93
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-01-23 15:51:55 +01:00
Mikolaj Boc
11891ae9c9 Skip tests outside of qtbase on batching+superbuild
The batcher does not currently work properly with non-qtbase
submodules. Disable them temporarily so that at least the
tests in qtbase are batched. Do this from qtbase so that changes
to each and every submodule are not necessary.

Also, maintain a list of tests that were thus skipped. On any
qt cmake internal function call that refers to such a target,
identify the target as skipped and make the call a no-op.

Fixes: QTBUG-109785
Change-Id: Ib0aa5d39eee8315ffd4ac62f6d1f44fe9bbf7a2f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-01-23 15:23:10 +01:00
Friedemann Kleint
69e478480a QTestlib: Disambiguate static functions
They cause clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: I2920cc3f36ad60be1ee618c16653df5bc259019a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-01-23 14:57:55 +01:00
Toni Saario
3b049fd6db Coin: Increase CPU core count to 8
More cores allow faster building and reduces variance when cache
is cold.

Task-number: COIN-1001
Change-Id: Idc08f19b788dcf2483342b8ae2c76b663eba537b
Reviewed-by: Simo Fält <simo.falt@qt.io>
2023-01-23 15:57:55 +02:00
Marc Mutz
577276d12c tst_QUrlQuery: fix Clang 15 -Wself-move
Says Clang 15:

  tst_qurlquery.cpp:193:11: warning: explicitly moving variable of type 'QUrlQuery' to itself [-Wself-move]
    moved = std::move(moved);
    ~~~~~ ^           ~~~~~

It's amazing how little it takes to throw this warning off guards:
just use an alising reference instead of the same variable. Makes you
wonder whether the time spent on detecting such trivialities in the
compiler is really well spent.

Amends fc8dad2f10.

Pick-to: 6.5
Task-number: QTBUG-109842
Change-Id: I165af2a786aa0ba28b8dcd039a500f3494bc29a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-01-23 10:12:35 +01:00
Mikolaj Boc
c54416a06c Handle the wheel event in the wasm window
Align the wheel event handling with other events - move the handler to
wasm window and create a C++ wrapper class for the js wheel event.

Fixes: QTBUG-109622
Change-Id: I915e502de7c0784ec9a6745a90ddcda062e91b2b
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-01-22 23:24:01 +01:00
Ahmad Samir
5d356ae2bd Fix two variables' "may be used uninitialized" compiler warnings
Change-Id: Ie6063d7124b16681b3e39d465da21dd67206ebc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-01-22 21:19:36 +02:00
Thiago Macieira
7e64ecacb6 IPC: switch the default key type on Unix to POSIX realtime
Instead of the System V one. An important difference is that
QSharedMemory does not clean after itself.

Updated the configure summary output to include this information.
Drive-by update to sorting order and I removed cpp-winrt from the
listing because there's a warning at the end if it is not set.

Change-Id: I12a088d1ae424825abd3fffd171e0eadcfd33426
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:11 -03:00
Thiago Macieira
0740ab56d7 IPC: add support for multiple backends to QSharedMemory
Simultaneously.

Change-Id: If4c23ea3719947d790d4fffd17152760989b9bc6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:02:11 -03:00
Thiago Macieira
32a06e9830 IPC: add support for multiple backends to QSystemSemaphore
Simultaneously.

Change-Id: If4c23ea3719947d790d4fffd17152a29e6c217d3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:02:10 -03:00
Thiago Macieira
968d9584ff IPC: allow QSystemSemaphorePosix to build on Windows
The MinGW-provided winpthreads has <semaphore.h> and the necessary
functions, though the source seems to implement sem_open() as an
unconditional
  errno = ENOSYS;
  return SEM_FAIL;

But in case they actually implement it, we enable support.

Change-Id: I3d74c753055744deb8acfffd1723e982d05651b5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:02:09 -03:00
Thiago Macieira
4141c5e221 IPC: fix cleaning up after tst_QSharedMemory tests
If a previous test in the same process or previously leaked a shared
memory or semaphore handle, tests could fail and cascade down. They
could also interfere with one another. So prevent this issue by
assigning a monotonically-increasing identifier per test function or row
tested and improving how we clean up those we did create.

This shows we need the API to explicitly clean up.

Change-Id: I12a088d1ae424825abd3fffd171db61d6b68a411
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:02:08 -03:00
Thiago Macieira
6bc3a89c90 IPC: clean up #ifdef in tst_qsharedmemory.cpp
Change-Id: I12a088d1ae424825abd3fffd171db0debf823a12
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-22 13:02:07 -03:00
Thiago Macieira
bdaf3c458c IPC: remove the rekeying optimization for System V semaphores
It's hard to maintain it with multiple backends and I don't see the need
for it.

Change-Id: I12a088d1ae424825abd3fffd171d7bf6bbdf9a99
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:06 -03:00
Thiago Macieira
b330f212a9 IPC/QSharedMemory: call QSystemSemaphore::setKey only once (not 3)
And we particularly want to avoid calling with Create twice.

Change-Id: I12a088d1ae424825abd3fffd171d6ab1fb87221f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:05 -03:00
Thiago Macieira
2c286561bb IPC: add native key support to QSharedMemory
And deprecate the non-native key support API. Qt 7 may not even store
the old, non-native key.

Documentation in a new commit, when the dust settles.

Drive-by updates to the tst_QSharedMemory::attach row names, to fix
grammar and remove spaces and apostrophe.

Change-Id: I12a088d1ae424825abd3fffd171d3025c77f94d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-01-22 13:02:04 -03:00
Thiago Macieira
3ae052d3bb IPC: add native key support to QSystemSemaphore
And deprecate the non-native key support API. Qt 7 may not even store
the old, non-native Qt.

Documentation in a new commit, when the dust settles.

Change-Id: I12a088d1ae424825abd3fffd171d2b549eeed040
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-22 13:02:04 -03:00