summaryrefslogtreecommitdiffstats
path: root/src/plugins
Commit message (Collapse)AuthorAgeFilesLines
* Remove Windows 7, 8, and 8.1 codepathsOliver Wolff2021-07-302-32/+10
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-84432 Change-Id: I970d7d7e9ebdcf246a5be32d60066b4e5e948c27 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Windows QPA: Remove DwmIsCompositionEnabled() usagesYuhang Zhao2021-07-301-29/+5
| | | | | | | | | | | | | According to Microsoft Docs [1], DWM composition is always enabled and can't be disabled since Windows 8. Now that we are cleaning up pre-Windows 10 code, this apparently needs to be removed as well. [1] https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmiscompositionenabled Task-number: QTBUG-84432 Change-Id: I64dc049e0741600c8d0ae4db0e9e3bc98a211339 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Provide new code paths for OpenSSL v3Timur Pocheptsov2021-07-285-157/+275
| | | | | | | | | | | | | | | | With OpenSSL v3 it would be possible to compile-out functions, directly working with entities like RSA, DSA, DH and EC_KEY. For this you have to define OPENSSL_API_COMPAT >= 0x30000000L. This would break QSslKey and QSslContext. To mitigate this potential problem, we switch to the 'generic' API, that works with EVP_PKEY instead. All functionality will be preserved, except inability of QSslKey::handle() to get pointers to RSA, DSA, DH or EC_KEY. Fixes: QTBUG-95122 Pick-to: 6.2 Change-Id: Ic85b48502421c4330cf4877b52850539c855fa74 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDirIterator: add nextFileInfo()Marc Mutz2021-07-281-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Before this change, next() was the only way to advance the iterator, whether the caller was ultimately interested in just the filePath() (good) or not (bad luck, had to call .fileInfo()). Add a new function, nextFileInfo(), with returns fileInfo() instead. Incidentally, the returned object has already been constructed as part of advance()ing the iterator, so the new function is faster than next() even if the result is ignored, because we're not calculating a QString result the caller may not be interested in. Use the new function around the code. Fix a couple of cases of next(); fileInfo().filePath() (just use next()'s return value) as a drive-by. [ChangeLog][QtCore][QDirIterator] Added nextFileInfo(), which is like next(), but returns fileInfo() instead of filePath(). Change-Id: I601220575961169b44139fc55b9eae6c3197afb4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Windows QPA: Fix coordinates reported through UI AutomationAndré de la Rocha2021-07-271-10/+7
| | | | | | | | | | | | | | Conversion to/from native screen coordinates was incorrect and could fail for non-primary screens. This could cause a control's bounding rectangle to be incorrectly reported, or a search for a control based on its position within the window to fail, causing incorrect behavior with accessibility tools and other software interacting with the application using UI Automation. Fixes: QTBUG-91459 Pick-to: 6.2 6.1 5.15 Change-Id: I5d56584ff26d977cdd34d35af46644e32aa11e7c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* doCrypt() - check the error codesTimur Pocheptsov2021-07-231-1/+7
| | | | | | | | | Disabled (moved into the legacy provider) DES-CBC results in a crash, when setting key length. Pick-to: 6.2 6.1 5.15 Change-Id: Ie0b49424f11d8042ebecebfd3b6346263f730551 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Fix incorrect default plugin conditions on WindowsAlexandru Croitor2021-07-222-2/+2
| | | | | | | | | | | | | | The correct variable to check is WIN32 rather than WINDOWS. This affects which plugins get automatically linked in a static Qt build. Amends a3b58a7844f77bd416fad8307f8333ff7c0efacf Amends d385158d5213ef568b7629e2aa4a818016bbffac Pick-to: 6.1 6.2 Fixes: QTBUG-95283 Change-Id: Idf78c78a1029f4d13fb460c07bef3d2669e55b09 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Update deprecated NSAccessibility methodVolker Hilsheimer2021-07-211-1/+1
| | | | | | | | | | | accessibilityEnabledAttribute is replaced with isAccessibilityEnabled. https://developer.apple.com/documentation/appkit/nsaccessibility/1535024-accessibilityenabled?language=objc Fixes: QTBUG-95293 Pick-to: 6.2 6.1 5.15 Change-Id: Ie88fa61ad97d6c77dcec15e63a73f64c90011497 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix lcTlsBackend redefined in several places (plugins, static build)Timur Pocheptsov2021-07-208-53/+48
| | | | | | | | With -static build lcTlsBackend was duplicated. Pick-to: 6.2 Change-Id: I20ee0f9c7e2027a7033c9fbae628d0d91672e719 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Schannel: Fix ODR violation in static programsMårten Nordheim2021-07-203-39/+58
| | | | | | | | | The Q_LOGGING_CATEGORY macro defines a function, and for each backend the function would be defined (and defined differently). Pick-to: 6.2 Change-Id: I6522b5e3baf731e5ead0e21da009c970d580fa02 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Scale image with MDI icons using the correction factorVolker Hilsheimer2021-07-201-2/+2
| | | | | | | | | | | | | | | The buffer might be large than needed and contain a lot of uninitialized pixels. Scaling it down to the requested size is wrong, we need to scale it by the correction factor. Amends e56b8e1e59b6df7c7abd48b163abe6846849eb7a. As a drive-by, make the correction factor helper function static. Fixes: QTBUG-94733 Pick-to: 6.2 6.1 5.15 Change-Id: Ia5be2a77459321e30485d330b49cf57fdbb664d2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Hold QSslContext in shared_ptrMarc Mutz2021-07-185-13/+13
| | | | | | | | | | | ... instead of QSharedPointer. QSharedPointer performs twice as many atomic operations per pointer copy as std::shared_ptr, and this is private API, we're not bound by BC constraints, so we can port to the more efficient version. Change-Id: I2e2a02493565a7ca51c86ec0ed66b6ce7c763e41 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* SSL: port QSharedPointer<QSslContext> uses to std-compatible API subsetMarc Mutz2021-07-162-8/+8
| | | | | | | | | | | In preparation of porting to shared_ptr. Add a few strategic moves and remove a rather pointless comment stating the obvious. Change-Id: Ie1c0f3431af79bdb204e00d99323bf9f2d100d0d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Tidy up systemCaCertificates() function in OpenSSL backendEdward Welbourne2021-07-161-18/+11
| | | | | | | | | | | | | | | | | | As pointed out by Marc Mutz in another review, the Android branches of its #if-ery amounted to a complicated no-op, so simplify the #if-ery, add a TODO and then simplify the code thereby freed of the need to accommodate the #if-ery. In the process, initialize a set of filenames with the two filenames that we read certificates from after looping over the set, which might have left those files being read twice. Change-Id: I2ee4ee3c3cf40226ee6a50afd6127fa4a71d2834 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QCryptographicHash: use a std::array to hold result (was: QByteArray)Marc Mutz2021-07-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | The maximum size for a hash result is 64 atm. Even if, and esp when, we'll get to 128 and 256 bytes in the future, there's no reason to use dynamic memory, because the sizes will always be statically known. So use, essentially, a std::array<char, 64> to hold the result internally. Add a bit of convenience API on top to limit impact on the rest of the code and add a few static_asserts that ensure this is large enough. Then give users access to the internal buffer by adding QByteArrayView resultView() const noexcept. The documentation snippet is taken from QString::data(), suitably adjusted. Use resultView() in a few places instead of result(). [ChangeLog][QtCore][QCryptographicHash] Changed to use a statically-sized buffer internally. Added resultView() to access it. Change-Id: I96c35e55acacbe94529446d720c18325273ffd2f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Don't give plugins PUBLIC usage requirements part 2Alexandru Croitor2021-07-1513-19/+16
| | | | | | | | | | | | | Plugins shouldn't have public usage requirements. Amends 434ada8dcb6132b3a597ea56b57a66c627f51728 Pick-to: 6.2 Task-number: QTBUG-90819 Change-Id: Iffb3def07ea428b1c3c5b9873e259a4d5168b7a1 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Make some lists const and use ranged-for to iterate themEdward Welbourne2021-07-151-8/+9
| | | | | Change-Id: Ib43a9b165deb6f3141700961469acf2eb60862ec Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QSslContext: remove unused fromConfiguration()Marc Mutz2021-07-133-10/+1
| | | | | | | | | | All callers use the shared-ptr version these days. Change-Id: I77e9fc9ccb8a57bfebcad7883e9eaff3780748f0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Don't use a deprecated function if built/linked with OpenSSL v3Timur Pocheptsov2021-07-132-1/+20
| | | | | | | | | | SSL_get_peer_certificate was deprecated in OpenSSL v3 and can be 'compiled-out' using OPENSSL_API_COMPAT. Use SSL_get1_peer_certificate instead. Pick-to: 6.2 Task-number: QTBUG-94596 Change-Id: Iedb2e06e673e981cab79d4bf0147ac6f5f90089a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* macOS: Map QSurfaceFormat color space to NSWindow via ICC dataTor Arne Vestbø2021-07-121-2/+5
| | | | | | | | Instead of special casing sRGB. Pick-to: 6.2 6.1 Change-Id: I7ad20c4b9600210333d5e44c3a2d20ce7d39dd92 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* CMake: Use QtBase_SOURCE_DIR instead of QT_SOURCE_TREEJoerg Bornemann2021-07-123-3/+3
| | | | | | | | | | | | | ...where applicable to use a known CMake-provided variable in favor of our own cooked up one. This affects four plugins that are not supposed to be built out of tree, meaning QtBase_SOURCE_DIR is available (and identical to QT_SOURCE_TREE). Task-number: QTBUG-88090 Change-Id: I27f012e6c5fd99c3239a1dd65c0811c819dbcfe9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Simplify resource setup in WASM platform pluginJoerg Bornemann2021-07-121-7/+5
| | | | | | | | | | | | | Use the BASE argument of qt_internal_add_resource to avoid the specification of resource aliases. Use QtBase_SOURCE_DIR in favor of QT_SOURCE_TREE to use a known CMake-provided variable in favor of our own cooked up one. Pick-to: 6.2 Task-number: QTBUG-88090 Change-Id: I0d8b30a1564495db475ae58596b52b373b2b173e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* macOS: Don't make frameless tool windows miniaturizableVolker Hilsheimer2021-07-121-2/+4
| | | | | | | | | | | | | | Amends 556fbbea6e96c07c6cbd552c4179e5717e799acf, which breaks translucency of frameless tool windows. Possibly a bug in macOS, a window being made miniaturizable should not have side effects on background or translucency. Pick-to: 6.2 6.1 5.15 Fixes: QTBUG-95042 Task-number: QTBUG-65637 Change-Id: I651196e3cf8a9c59b250e5f1b4064cc4ded02372 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Diffie-Hellman parameters: remove useless 'fix'Timur Pocheptsov2021-07-093-58/+0
| | | | | | | | | | | | | | The workaround I had implemented based on alpha version of OpenSSL v3 and what developers (OpenSSL) said about DH back then is not going to work in the end - they do remove all DH (struct and related functions) stuff if you set a proper OPENSSL_API_COMPAT level. A proper re-write is required to support OpenSSL v3, but then there is no reason to keep dead useless code. Pick-to: 6.2 Task-number: QTBUG-94596 Change-Id: Iae092dd08148521649a684879d30e190736e1abe Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Dont's use DTLS_MAX_VERSION when setting SSL_CTXTimur Pocheptsov2021-07-091-2/+2
| | | | | | | | | | | It was fixed quite some time ago for TLS counterpart (TLS_MAX_VERSION), but somehow the similar fix was missing for DTLS. OpenSSL v3 deprecated those constants and they can be compiled out by OPENSSL_API_COMPAT. Pick-to: 6.2 Task-number: QTBUG-94596 Change-Id: Ia0246170a003db900c430b2fbfc177caf05a395a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* macOS: fix drawing of pushbuttons of non-standard sizeVolker Hilsheimer2021-07-091-25/+36
| | | | | | | | | | | | | | | | | | | | | | Cocoa renders the bevel of a push button always in the default height of 32 pixels. We handled the case that the button is larger than that by switching to "squared" mode, but buttons that are smaller than that got rendered incorrectly, with the bevel being clipped. Fix this by always rendering buttons in "squared" mode when the height of the widget is not the same as the standard. Adjust the default height for "mini" push buttons based on visual testing. Make the equivalent adjustment to the focus frame logic and general positioning so that buttons and frames are centered compared to other controls. As a drive-by, get rid of expensive QObject::inherits calls, and replace with qobject_cast. The headers for all the relevant widget types are already included. Fixes: QTBUG-85972 Pick-to: 6.2 Change-Id: I4ad66fac2313fbee385c1eadcc243f69c9cace70 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Use QCryptographicHash::hash() more widelyMarc Mutz2021-07-071-6/+2
| | | | | | | | | | ... instead of the "usual" rule of three: ctor, addData(), result(). Not only does it generate less code in the caller, it's now also faster. Change-Id: I67c7eeb01f527b90e80a08f60c1c7f2ec1e49dd4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Don't give plugins PUBLIC usage requirementsJoerg Bornemann2021-07-077-8/+7
| | | | | | | | | | | | | | | | | | | | The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. Pick-to: 6.2 Task-number: QTBUG-90819 Change-Id: Ibc7c2bcd3b6a9dc77df40c4c0c22ff254a80f33d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* macOS 10.15: Fix focus frame for combo boxesVolker Hilsheimer2021-07-061-0/+2
| | | | | | | | | | | | | | Amends df316963213e765de5b94469622df48b0c9a9e6e to take care of macOS 10.15 specifically, where the focus ring is a pixel too high and leaves a gap that's visible on high-dpi displays. On macOS 10.14 and before, and for editable comboboxes, the focus frame is correct. Fixes: QTBUG-94069 Pick-to: 6.2 6.1 5.15 Change-Id: I278aa30036808c06f8e71385d4797315e46d8f1d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: fix separator actions not showing in menusVolker Hilsheimer2021-07-051-14/+9
| | | | | | | | | | | | | | | | | Amends a3f3af8a8fb8f8b09d1685df5ab836244f850a62, which resulted in the last visible separator always getting hidden. Don't abuse QCocoaMenuItem::visible property to store whether the native NSMenuItem is shown, only store whether it should be shown. Rename the local variables to simplify the logic. Fixes: QTBUG-94802 Pick-to: 5.15 6.2 6.1 Change-Id: I56e8c99a2a46d8cbdf75c4ad6cb714961f28a6a3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove ministro codeAssam Boudjelthia2021-07-012-21/+3
| | | | | | | | | | | | | | Since Ministro no longer work on recent Android versions (Android 8+), and it hasn't been maintained and the repos are not updated, the existing code is practically a dead code. [ChangeLog][Android] Remove ministro code since it's been unmaintained and not working with recent Android versions. Task-number: QTBUG-85201 Pick-to: 6.2 Change-Id: I18d7b1e209cba3cfd04674060e9bf39aa5a5510f Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Fix memory leak of QOffscreenScreen in QOffscreenIntegrationMilian Wolff2021-07-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Call handleScreenRemoved when the QOffscreenIntegration is getting destroyed. Fixes memory leaks such as this one: ``` $ memcheck --leak-check=full ./tst_qlabel -platform offscreen ... ==117791== 472 (88 direct, 384 indirect) bytes in 1 blocks are definitely lost in loss record 166 of 267 ==117791== at 0x483EF3F: operator new(unsigned long) (vg_replace_malloc.c:417) ==117791== by 0x48C0939: QOffscreenIntegration::configure(QList<QString> const&) (in /home/milian/projects/qt5/src/qtbase/build/plugins/platforms/libqoffscreen.so) ==117791== by 0x48C0B60: QOffscreenIntegration::createOffscreenIntegration(QList<QString> const&) (in /home/milian/projects/qt5/src/qtbase/build/plugins/platforms/libqoffscreen.so) ==117791== by 0x5381CB4: init_platform(QString const&, QString const&, QString const&, int&, char**) (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Gui.so.6.2.0) ==117791== by 0x5384E05: QGuiApplicationPrivate::createPlatformIntegration() (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Gui.so.6.2.0) ==117791== by 0x5385B1F: QGuiApplicationPrivate::createEventDispatcher() (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Gui.so.6.2.0) ==117791== by 0x5C67A76: QCoreApplicationPrivate::init() (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Core.so.6.2.0) ==117791== by 0x5387826: QGuiApplicationPrivate::init() (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Gui.so.6.2.0) ==117791== by 0x4C00368: QApplicationPrivate::init() (in /home/milian/projects/qt5/src/qtbase/build/lib/libQt6Widgets.so.6.2.0) ==117791== by 0x11D7D9: main (in /home/milian/projects/qt5/src/qtbase/build/tests/auto/widgets/widgets/qlabel/tst_qlabel) ==117791== ``` Pick-to: 6.2 Change-Id: Ibf4e6f4258514f85f23bb91b29008b837016edbc Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* wasm: fix mouse, touch and wheel event propagationLorn Potter2021-06-262-11/+13
| | | | | | | | | Otherwise touch pad and wheel + ctrl cause the window to be zoomed, which is not what happens on desktop. Pick-to: 6.2 Change-Id: Ic841b7c2ab56846db9f030abaeb9efa7d3dd4dcf Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Schannel: Get rid of Windows < 10 codeMårten Nordheim2021-06-251-7/+4
| | | | | | | | | No need to check if we're running on windows 8.1 or above. We always are. Pick-to: 6.2 Change-Id: I9f2e7a58631064e573725705882a603e900c7e39 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* TLS: Mark TLS 1.0, 1.1 and DTLS 1.0 deprecatedMårten Nordheim2021-06-258-7/+70
| | | | | | | | | | | | As per the best practice laid forth in RFC-8996. TLS 1.2 was recommended from 2008 until TLS 1.3 was released in 2018. [ChangeLog][QtNetwork][QSslSocket] TLS 1.0, 1.1 and DTLS 1.0 are now deprecated, as recommended by RFC-8996. Fixes: QTBUG-92880 Change-Id: I90cebcfb07cfce623af7ac9f2b66ce9d02586b54 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QSslSocket: Set isEncrypted to false on disconnectMårten Nordheim2021-06-252-0/+2
| | | | | | | | | Since we're no longer connected, much less encrypted. Was done in schannel backend, but not in ST or OpenSSL Pick-to: 6.2 Change-Id: Ia49387be0088f899a0c89091f7e468dba1c0eee6 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Schannel: fix compilation with QSSLSOCKET_DEBUGMårten Nordheim2021-06-241-1/+1
| | | | | | | Small leftover mistake Change-Id: I0cb55fe78a2666665a3c56b41200c127a42df0c2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_http2: use the supportedFeatures() instead of macrosTimur Pocheptsov2021-06-241-0/+4
| | | | | | | | | | | With the recent change, 'system' headers gone: not in the test code anymore, so, for example OPENSSL_VERSION_NUMBER is undefined, making the test to select a wrong code-path - 'h2c', instead of encrypted h2. Pick-to: 6.2 Pick-to: 6.1 Change-Id: I3b201e21fac56875c9045c7463e2ae69af4c6470 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* xcb: fix cursorTheme update issueTang Haixiang2021-06-241-2/+6
| | | | | | | | | | | | | | | Clear the cache when cursor theme changed. Idealy we should subscribe root window's RESOURCE_MANAGER property to update cursor theme via Xcursor. KDE already has a daemon KDE GTK Configurator to sync KDE settings to GTK. Then we can register the fallback there both for KDE and GTK changes. See also https://invent.kde.org/plasma/kde-gtk-config Fixes: QTBUG-94538 Pick-to: 6.2 6.1 6.0 5.15 Change-Id: Ia4de30930a0dc1dc306c61e1553970c3dab67bd6 Reviewed-by: Liang Qi <liang.qi@qt.io>
* macOS: Unregister screen notification handlers on QGuiApplication shutdownTor Arne Vestbø2021-06-232-3/+16
| | | | | | | | | | | | In the case of a plugin, the plugin might be unloaded, and destroy its QGuiApplication. We don't want the screen notification handlers to outlive the application, as that results in crashes. Fixes: QTBUG-91919 Pick-to: 6.2 6.1 5.15 Done-with: Yang Yang Change-Id: I3a4c0fcf97b785357516d1dac34489511400f154 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* wasm: do not quit() on beforeunload()Morten Sørvig2021-06-232-15/+0
| | | | | | | | | | | | | | | | | | | | | This is the wrong event: exiting the app here it is not compatible with the back/forward cache for instance. See the the MDN docs for the “Window: unload” event. Instead, make the Qt default be that we assume the app process will live “forever” until the browser terminates it, much like modern process handling on e.g. iOS. We may want to come back to app lifecycle handling at a later point. This might require changes to application code: implementing main() in such that it supports clean shutdowns and auditing showdown code to make sure it is web-compatible. Change-Id: I0f32026a3af76c9cc79e3aab31e8aaed7b8f8023 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Tidy up in OCI driver codeEdward Welbourne2021-06-221-36/+42
| | | | | | | | | | | | | Use nullptr instead of 0 for null pointers. Compare OCIHandleAlloc() return values to OCI_SUCCESS rather than 0. Initialize instance variables in the class where possible, rather than in the constructor. Conform to coding style o long lines and braces. Assert pointers are null before allocating and overwriting them, so we might have a chance of catching leaks. Change-Id: Ia885ec18f46de5219a51fb6f9f23f474b3046585 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Move tidy-up of private to its own destructorEdward Welbourne2021-06-221-8/+4
| | | | | | | | | | | QOCIResult::~QOCIResult() was doing part of the tidy-up for QOCIResultPrivate, whose own destructor took care of the rest. So move that part to the private, where it makes more sense. Also correct an error message in part of the private's existing tidy-up and eliminate a needless local variable. Change-Id: I09a51c72afd7a30bcee7f6127c59d703650f1c41 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix potential double-free in QSqlCachedResult::cleanup()Edward Welbourne2021-06-221-1/+3
| | | | | | | | | | | If d->sql is non-null, it gets freed; later in the same function, it gets reallocated, unless the query is empty, in which case the now-freed value was still recorded, so that later clean-up might find it and mistakenly think it needs to be freed again. Clear when freeing. Pick-to: 6.2 6.1 Change-Id: I8d37d2ba1fcaa320916eaf30dceaa720bbf62f38 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix leak of transaction context handle in QSql's OCI driverEdward Welbourne2021-06-221-11/+21
| | | | | | | | | | | | | | Transaction handles were allocated but nowhere freed. Thanks to Stefan Latsch for pointing this out and suggesting the fix. Make the handle yet another member of QOCIDriverPrivate so that close() can free it. At the same time, also free the service context handle d->svc when failing do open(); and shuffle the order of frees to be the reverse of the order of allocations. Fixes: QTBUG-94246 Pick-to: 6.2 6.1 5.15 Change-Id: I45818ada6d884b06028056d28635390a300e2def Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* wasm: enable MODULARIZE option and set EXPORT_NAMEMorten Sørvig2021-06-221-24/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | Make Emscripten generate a global constructor function ("createQtAppInstance()") instead of a global javascript module object. This enables more fine-grained control over module instantiation; previously the module object would be created when the runtime javascript was evaluated, and the number of emscripten module/instances was limited to one per page. Set EXPORT_NAME to “createQtAppInstance” which avoids collisions with other non-Qt Emscripten modules on the same page. A further improvement would be to include the app name in EXPORT_NAME, but this is not done at this time. Update the code in qtloader.js to call the constructor function instead of working on a global module object. The qtloader.js API is functional before the wasm and Emscripten modules have been instantiated; store properties and forward to the Emscripten module when it's created. Change-Id: I12c49a5b9a4a932bbc46fcc5e5ecc453fd0fe7f0 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: use module_property instead of global(“Module”)Morten Sørvig2021-06-222-22/+7
| | | | | | | | | | | | | | Depending on build options, the module can have a different name, or be a non-global object. We were already using module_property in many places, but some were missing. In the case of the clipboard code, there is actually no need to export all of the C++ functions to JavaScript and then resolve them from the module; instead call them directly. Change-Id: I83aa3ad01ad961d48e21f0994e0c205d833cbe8a Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: remove event listenersMorten Sørvig2021-06-221-1/+9
| | | | | | | | | | Remove event listeners on shutdown. For emscripten event callbacks this can be done by passing nullptr as the callback, for DOM event listeners use the “removeEventListener” API. Change-Id: I5a32a6a8feb906082db5ef3d0a0cd7ecb3b54292 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* wasm: don’t leak QWasmScreen member variablesMorten Sørvig2021-06-222-6/+6
| | | | | | | | | m_compositor and m_eventTranslator are owned by the screen object and can be held in a unique_ptr. Pick-to: 6.2 Change-Id: I7d5e19e7ac6f762f360d6af0fc9500e6964f737e Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: fix non-void function returnLorn Potter2021-06-211-2/+3
| | | | | | Pick-to: 6.2 Change-Id: Ia7ef3367c0531f953c78e43297f67d61b08dbf17 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>