summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* QMap: fix UB (invalid cast) in QMapData::end()Thiago Macieira2017-04-111-2/+4
| | | | | | | | | | | | | | | | | | The end() pointer, like in all other containers, is a sentinel value that must never be dereferenced. But unlike array-based containers, end() in QMap is not "last element plus one", but points to a base class of Node, not a full Node. Therefore, the casting from QMapNodeBase to QMapNode must not be a static_cast, reinterpret_cast is required. libstdc++-v3's red-black tree had the exact same problem: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60734 Change-Id: I43f05fedf0b44314a2dafffd14b33697861ae589 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> (cherry picked from commit 75cdf654bcc192ba73a8834e507583a59140e7e4) Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* QtWidgets: Fix white text color on tabs on macOS for non-macOS stylesBłażej Szczygieł2017-04-111-3/+2
| | | | | | | | | | | | Apply white text only for macOS style. Amends 2c0033983bc53e906eab3f4b2fae836ff8472713 Task-number: QTBUG-59784 Change-Id: I9e66e929699efd715ed4565394f1aba763aeb32a Reviewed-by: Jake Petroules <jake.petroules@qt.io> (cherry picked from commit 2fbc1432025dd478cf9e940e3c2a1952b218c6dc) Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* doc: fix variable name in QDBusArgument::beginMap() exampleRolf Eike Beer2017-04-101-1/+1
| | | | | Change-Id: I77731a4c8479a4db46b981993d72f28eb19f7594 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add gradle wrapper to Qt & update default Andriod gradle pluginBogDan Vatra2017-04-109-2/+1268
| | | | | | | | | | We need to add gradle wrapper to Qt because it was removed from latest Android SDK. Adding it to Qt, will give us more control and will save us from pain in the future. Task-number: QTBUG-59237 Change-Id: I6419876f8be11c0feeac448b228a46f811065264 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 12a0e1b4f8c0e66b373b11b83956d1fa292c7ac4)
* Fix menu position when highdpi scalingMorten Johan Sørvig2017-04-071-2/+3
| | | | | | | | | | | | | | | | | | | Certain display and scale factor configurations would cause menus to pop up in incorrect locations or not be shown at all. This was due to QDesktopWidget::screenNumber() having a toNativePixels(QRect, QWindow) call which requires that QWindow::screen() returns the correct screen. Break the circular dependency by converting coordinates the other way for the intersection test: transform screen geometry to device independent coordinates. Task-number: QTBUG-58329 Change-Id: I5ff2a5b14296ddbf7d8ddca11420988aae6cc0bd (cherry picked from commit 5e76cb16924a42cb020786f45cc3494dd5836c5c) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QCryptographicHash: make SHA3 calculate SHA3, not KeccakGiuseppe D'Angelo2017-03-312-76/+142
| | | | | | | | | | | | | | | | | | | | The SHA3 family is a modified version of Keccak. We were incorrectly calculating Keccak (and even *testing* Keccak!), but claiming it was SHA3. To actually calculate SHA3, we need invoke Keccak on the original message followed by the two bits sequence 0b01, cf. §6.1 [1]. [1] http://dx.doi.org/10.6028/NIST.FIPS.202 [ChangeLog][QtCore][QCryptographicHash] QCryptographicHash now properly calculates SHA3 message digests. Before, when asked to calculate a SHA3 digest, it calculated a Keccak digest instead. Task-number: QTBUG-59770 Change-Id: Iae694d1a1668aa676922e3e00a292cddc30d3e0d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 88a8feeacb9bdaff9ee06164424e407eb904cd10)
* QCryptographicHash: fix documentation of the supported algorithmsGiuseppe D'Angelo2017-03-311-1/+2
| | | | | | Change-Id: Idfa7843ef8a8e3410ae0a8cf5311b8b598299730 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit cd9e850f9e9620a8bafec964efad8098443be7f1)
* Fix floating dock widget having the wrong parentOlivier Goffart2017-03-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When dragging out a tabbed group which contains placeholder for floating QDockWidget, the floating QDockWidget would not be reparented to the new QDockWidgetGroupWindow. That's because QDockAreaLayoutInfo::reparentWidgets does not reparent floating widget (because of the item.skip test) However, we need to be careful when reparenting to pass the flags so it does not get docked. Also do not reparent QDockWidgetGroupWindow which may end up temporarily in the layout during animation when dragging a QDockWidgetGroupWindow onto another. Step to reproduce a crash that if fixed by this patch (with the mainwindow example): 1. Enable QMainWindow::GroupedDragging from the "Main window" menu 2. Add a new dock widget, "Foo", from the "Dock Widgets" 3. Tab "Foo" together with the black dock widget 4. Drag "Foo" out. (Now, Foo is still a child of the QMainWindow, and is still in the layout as tabbed, but is skipped) 5. Drag the black dockwidget out. (This, in fact, crates a QDockWidgetGroupWindow which contains the black dockwidget and the floating "Foo", but since "Foo" is floating, it is not reparented) 6. Destroy "Foo" using the "Dock Widgets" menu. (Since Foo's parent is the QMainWindow, it is not removed from the QDockWidgetGroupWindow's layout, which will cause crash on the next relayout)" This commits amends commits d57bb19902f863fc6db07674f6bd8881b0886b39 and 0feeb6f6d2cfaa964763ca1fcab65672812b4eef Change-Id: I600a56cdd889435b83d2b740598a24d81059bf44 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> (cherry picked from commit ee84af00d1ad28138a66ac422b1edb7be896512b)
* Fix crash in QWindowPrivate::applyCursor when screen is nullOlivier Goffart2017-03-272-8/+11
| | | | | | | | | | | | | | QWindow::setVisible calls QWindowPrivate::applyCursor without checking if screen() returns null. This patch adds a check in QWindowPrivate::applyCursor that the screen is not null. Now that it is tested there, no need to test it from the other caller (setCursor) This patch should not change behavior of setCursor at all, it should only fix the crash when coming from setVisible Task-number: QTBUG-59528 Change-Id: I06bbdb4e04c02ac840ba637242d1f2cfde5bdd62 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 5cda0172e0eb912ef4814f3c5618686cbb1a5da1)
* Bump copyright yearFriedemann Kleint2017-03-271-1/+1
| | | | | | | Task-number: QTBUG-59648 Change-Id: Ie2d08515f4ad177bab338210a0a3e52f5519dcc3 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit e8d03c5599e468937b0e4270309a3be3d710df8f)
* QVarLengthArray: fix compilation with GCC 7Marc Mutz2017-03-271-0/+1
| | | | | | | | | | | | | | | | | | | This fixes a warning-turned-Werror in qdistancefield.cpp: In member function ‘void QVarLengthArray<T, Prealloc>::realloc(int, int) [with T = bool; int Prealloc = 256]’, inlined from ‘void makeDistanceField(QDistanceFieldData*, const QPainterPath&, int, int)’ at ../../include/QtCore/../../../../qt5/qtbase/src/corelib/tools/qvarlengtharray.h:275:10: ../../include/QtCore/../../../../qt5/qtbase/src/corelib/tools/qvarlengtharray.h:390:19: error: ‘void* memcpy(void*, const void*, size_t)’: specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] memcpy(ptr, oldPtr, copySize * sizeof(T)); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Apparently GCC cannot rule out that copySize may be negative in the call to memcpy. Put GCC on the right track by adding a Q_ASSUME. Change-Id: I63e3801e52ebe2a7f77e3a97ef03ec3869319c8c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> (cherry picked from commit 5ca7d56aca5d7cae3f6eefad181839f9b3a2ece6)
* WINCE: Don't receive touches by default from gesturesAndreas Holzammer2017-03-245-2/+12
| | | | | | | | | | | | Windows Embedded Compact does send events from touch devices, as mouse event and as gesture event. There is no way to distinguish between a regular mouse event coming from a a connected physical mouse or a touchscreen. There is also no way to tell Windows to not deliver these touches as mouse events. Change-Id: Ia894ef9d1c0f8650f45f5bc328ce48f2505cac40 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QDockWidget: Fix memory leak when dragging a tab outside of a floating tab ↵Olivier Goffart2017-03-241-1/+2
| | | | | | | | | | | | | | | | window A QDockWidgetItem will be leaked if a QDockWidget is dragged out of a floating tab window, and then plugged back somewhere. The problem is that QMainWindowLayout::unplug was not returning the QDockWidgetItem* from the floating tab's layout. When that's the case, a new QDockWidgetItem is created in QDockWidgetPrivate::startDrag and will be put into the layout, leaking the old QDockWidgetItem. Change-Id: Ifb9c1c562cb74383ebff1df0f91ee225c5cdb296 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> (cherry picked from commit 4d3781b640e8fb0a04e96b2d05199247556b8d86)
* Fix hang on sleep/wakeupBogDan Vatra2017-03-231-9/+8
| | | | | | | | | | | | | | This patch fixes the followings: - call "it.value()" only on valid iterators - destroySurface() doesn't remove the surfaceId from m_surfaces - the surfaceId is removed from m_surfaces when the QtSurface is really destroyed Task-number: QTBUG-59185 Change-Id: Iee37dde16fee16f19906812c55c1f0b0279b033c Reviewed-by: Mathias Hasselmann <mathias.hasselmann@kdab.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit da4b91e2b2c6bb7949e2151a72be1f11c28768d6)
* QGuiVariant: fix unintended fall-throughMarc Mutz2017-03-221-0/+1
| | | | | | | | Found by GCC 7. Change-Id: I8a9cca5236f077335031afc90b2683a2846d3b79 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> (cherry picked from commit 8f7776df5e649a99377776d4f2b91c220632f36f)
* QToolBox: fix potential UB (invalid cast) in Private::_q_widgetDestroyed()Marc Mutz2017-03-221-6/+4
| | | | | | | | | | | | Don't cast an expiring QObject down to QWidget. Cast the QWidgets stored internally up to QObject to perform the comparison. The result is the same, but no invalid casts are possible anymore. Found by independent review. Change-Id: Iffa8a66cf5cab0270961befe982637ac8e4f0f7b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 26bc4ac5cb56ce8f2d3d10125fa9c6a72140573a)
* tst_QMimeDatabase: increase update-mime-database timeout to 4minsMarc Mutz2017-03-221-1/+6
| | | | | | | | | in the vain hope to get the CI unstuck again. Change-Id: I1b01bb1d59a8850f68d1d80838f5606f4159bcbd Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> (cherry picked from commit 1b73d1397555b99385c03eba8b5e6347b49d27f9) Reviewed-by: David Faure <david.faure@kdab.com>
* PostgreSQL: fix datetime format when system locale doesn't use arabic numeralsMichael Jabbour2017-03-221-1/+4
| | | | | | | | | | | psql driver was previously using QDateTime::toString() function which is locale-depndent. Task-number: QTBUG-59524 Change-Id: I7f50f95b5c82e66476abfee24ad28b78b3257041 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit ac74abdf50f7047cf43b3577a70d0995e197659d) Reviewed-by: Julien Blanc <julien.blanc@nmc-company.fr> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QDir::mkpath: don't try to mkdir in automount filesystemsThiago Macieira2017-03-202-34/+66
| | | | | | | | | | | | | | | | | Automount filesystems like /home on many operating systems (QNX and OpenIndiana, at least) don't like if you try to mkdir in them, even if the file path already exists. OpenIndiana even gives you an ENOSYS error. So instead, let's try to mkdir our target, if we fail because of ENOENT, we try to create the parent, then try again. Task-number: QTBUG-58390 Change-Id: Ibe5b1b60c6ea47e19612fffd149cce81589b0acd Reviewed-by: James McDonnell <jmcdonnell@blackberry.com> Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit d9a2dd8d3b55d16d2e38d124abb0ade490963b37) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Call disconnectNotify() when disconnecting a QMetaObject::ConnectionUlf Hermann2017-03-172-4/+24
| | | | | | | | | | | In all other forms of disconnecting this is done. We also know the signal index, so there is no reason not to do this. Change-Id: Ic8b042cd8f45dbff74b42ee30c384a84bef78b20 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> (cherry picked from commit 972580accdd0732b33947e8b1ca0ba8943041bdc) Task-number: QTBUG-59500 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* linux-icc: always compile applications as position-independent execsThiago Macieira2017-03-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The problem isn't the compiler, but the linker, so we ought to turn this flag on for all ELF-based systems where we compile Qt with -Bsymbolic, but so far only the Intel compiler has been affected. We can turn it on as needed for other systems. The cause of the problem is the way that ICC materializes the pointer- to-member-function: it stores the full 2*sizeof(void*) data in an anonymous variable, so that it can load it in one go, such as one 16- byte SSE aligned load on 64-bit systems. That relocation in a data variable gets turned into a fixed-position copy relocation by the linker, which breaks the signal-identification mechanism. GCC and Clang are likely to be affected if anyone did: static const auto destroyed = &QObject::destroyed; QObject::connect(obj, destroyed, [](){}); Task-number: QTBUG-52439 Change-Id: I0d69eaf61af149db9574fffd149d0cfb08459c33 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> (cherry picked from commit 51dafeda8c833134acf7da40f7ad58cec349ee30) Reviewed-by: Dominik Haumann <dhaumann@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QChar: fix docs of (uchar) ctorMarc Mutz2017-03-161-2/+2
| | | | | | | | | | The constructor is not only disabled under QT_NO_CAST_FROM_ASCII, but also under QT_RESTRICTED_CAST_FROM_ASCII. Change-Id: I7bbaf2891913d5256dff7f80c49075ea3326155a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit e364384d9f91e57ad6116d549f3748d165b77ea2)
* Fix parsing of day-of-week names that start with another nameThiago Macieira2017-03-162-32/+59
| | | | | | | Task-number: QTBUG-59159 Change-Id: I95c9e502ccc74af3bcf0fffd14a69e0cd27ce96b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 04b8db3d57970631351fc6330af9553e94f1b14d)
* Close popups when blocked by modal dialogPaul Olav Tvete2017-03-143-1/+3
| | | | | | | | | Don't block the event that Qt depends on to close popups. Task-number: QTBUG-57292 Change-Id: Ida1f928b81868f68a7b1e19cd0b83485d2a7232e Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 5b65698248325576faa03a2bb78d17349a33a194)
* xpm image format: Reject corrupt images with invalid header infoEirik Aavitsland2017-03-141-0/+3
| | | | | | | | | | The xpm handler did not properly check that the information read from the file header was sane. Task-number: QTBUG-59211 Change-Id: I84099777a16b2b0c473d139f5fdec1d0cb5d515e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 0d287500be09c800fbcc8f04862d316075ced546)
* QAtomic: pass explicit failure memory order to ↵Marc Mutz2017-03-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::atomic::compare_exchange_strong GCC 4.8 seems to get the failure memory order wrong when using the overload that only accepts one memory order and produces errors such as: bits/atomic_base.h:577:70: error: failure memory model cannot be stronger than success memory model for '__atomic_compare_exchange' return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, __m1, __m2); ^ (as seen on Android). Fix by explicitly passing the failure orders corresponding to the success orders, as specified by the standard: relaxed → relaxed release → relaxed acquire → acquire acq_rel → acquire (cf. http://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange). Task-number: QTBUG-59399 Change-Id: If046e735888cf331d2d6506d8d5ca9aa7402f9ad Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> (cherry picked from commit 5cc0de2e084cb887a75b076b82cf470ecdcd4dd3) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimeZone: do not access static functions through this->Marc Mutz2017-03-081-7/+7
| | | | | | | | | | | | | The this pointer cannot be null, so we can't do d->staticFunction while d is a null pointer. This was caught by Clang 3.8's ubsan. Conflicts: src/corelib/tools/qtimezone.cpp Change-Id: I3c0d39b88cca83d827a69ed1544a4412b18ac907 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 809cef1732df9f843dc895cfb3f4b3e58646e050) Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix for horizontal scrollbarsLambert Duijst2017-03-081-2/+2
| | | | | | | | | | Horizontal scrollbars scroll in the wrong direction when the app has a stylesheet and the LayoutDirection is RightToLeft. Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 00c9ec63a552d040e851b561c11428fabf1a2b08) Change-Id: I00d21ec9e1b4b4e86ee8f5ad84ac093f642edd03 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
* xcb: fix misuse of xcb_send_eventGatis Paeglis2017-03-084-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following Valgrind warning: "Syscall param writev(vector[...]) points to uninitialised byte(s) Uninitialised value was created by a stack allocation" The xcb_send_event() requires all events to have 32 bytes. It calls memcpy() on the passed in event. If the passed in event is less than 32 bytes, memcpy() reaches into unrelated memory. And as it turns out, this behavior is actually described in the xcb_send_event function's documentation. This patch adds a macro that declares an event for safe usage with xcb_send_event. The cherry picked change contains one minor adjustment to support older compilers: q_padded_xcb_event<event_type> store = {}; was replaced with: q_padded_xcb_event<event_type> store = q_padded_xcb_event<event_type>(); Change-Id: Id0cfc2b1ae9e105e8b4328fdaba03300cb718840 Done-with: Uli Schlachter Task-number: QTBUG-56518 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> (cherry picked from commit 1a5deb7e0ea9a129d4ebc59677893c7477ad5a3a)
* Fix documentation typosChristian Gagneraud2017-03-033-3/+3
| | | | | | | | | | | This patch fixes 2 simple typos in QGraphicsItem and QPainter documentation and a copy/paste error between QAbstractItemModel's beginRemoveColumns and beginRemoveRows documentation. Change-Id: I32bdc4dc69154a40fe30a5b8c08d0c3a001853f8 Reviewed-by: Harri Porten <porten@froglogic.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> (cherry picked from commit e3bcab935c9fe37b344394c3ee8afd6773a8cd7e)
* Fix crash for glyphs with height > 128Eskil Abrahamsen Blomfeldt2017-03-031-2/+2
| | | | | | | | | | | | | | | | In fe97ecf408da60931fc49b502a223d59b5f93f99 we added support for arbitrarily sized glyphs, since there is no guarantee that a glyph will fit inside the em square. There was, however, a hardcoded max size in the distance field generator, so for very tall glyphs we could potentially get a crash. [ChangeLog][QtGui][Text] Fixed crash for very tall glyphs Task-number: QTBUG-57241 Change-Id: I0a9afcc6cc3769543390f0f292519a6fe840689c Reviewed-by: Yoann Lopes <yoann.lopes@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> (cherry picked from commit 6965b8a59217e5f1db9e5986d6ccc8f5ff5f4e9c)
* Blacklist tst_QPauseAnimation::multipleSequentialGroups()Marc Mutz2017-03-021-0/+2
| | | | | | | | | It's been determined to be be flaky on the CI, but only on the 5.6 branch. Task-number: QTBUG-59218 Change-Id: I23c6673b2824c982bf30574888bca7c3306d0ecc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Blacklist tst_QTimer::remainingTime() on Windows and macOSFriedemann Kleint2017-03-021-0/+3
| | | | | | | | | Task-number: QTBUG-58519 Change-Id: Ib03aa0bdeaa9ed0dc2f0d92aa11d07ffcdc2bc26 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> (cherry picked from commit 737383875e3878beebedbc04492d8b8d9d13bc71) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Android: Fix OpenGL shader compilation on updated emulatorEskil Abrahamsen Blomfeldt2017-02-281-4/+0
| | | | | | | | | | | | | | | | | | | | In 0ae4b948515af904dba397448839056d9b7965af, we added a work-around specifically for the Android emulator, causing it to override the precision qualifiers in shader code, since the emulator would send the shader code directly to the host OpenGL driver and thus there was no guarantee that the qualifiers would be supported. Since then, the original issue with the emulator has been fixed, so now Qt applications are failing because of the work-around. [ChangeLog][Android] Removed old work-around which was causing OpenGL shader compilation to fail on updated Android emulators. Task-number: QTBUG-44697 Change-Id: Ia1f8e754b092bc5cb3adb0d4add92e7908ada86c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com> (cherry picked from commit 440ccba0ab43a3980c36fbd073aa2c466c9a4df0)
* Fix crash while dropping a tabbed group into a single floating QDockWidgetOlivier Goffart2017-02-232-5/+3
| | | | | | | | | | | | | | | | | The problem was caused by commit 0feeb6f6d2cfaa964763ca1fcab65672812b4eef which fixed QTBUG-58036. It reparented widget that used to be skiped. In particular, floating widgets are skiped. But seting the parent of a floating widget docks it. And so as a result it would not be skiped anymore. This has two side effect: This breaks the animation (as the widget is docked too early; and cause crash when QDockWidgetGroupWindow get reparented as this breaks invariant that these are always floating. So restore the skip from before commit 0feeb6f6d2cfaa964763ca1fcab65672812b4eef, and explicitly set the parent in all cases when the animation finishes. Change-Id: I0e3e29ad22d6ffe4d62242d48a18dadb916fc14f Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> (cherry picked from commit d57bb19902f863fc6db07674f6bd8881b0886b39)
* QFileDialog: Protect against nullptr dereferenceKevin Funk2017-02-231-1/+1
| | | | | | | | | | | | | | | When the QFileDialog receives a language change event, and native dialogs are used, this code path dereference a nullptr in the qFileDialogUi member. Protect by checking the return value of QFileDialogPrivate::usingWidgets() as done in other places deferencing qFileDialogUi. Fixes a crash in GammaRay Change-Id: I3e9eb81c75d9fc983519a58c5ec06e316ac80263 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> (cherry picked from commit e0c43fb046795ca6d64d621b1467905abc41186d)
* QLoggingRegistry: fix potential data raceMarc Mutz2017-02-222-7/+16
| | | | | | | | | | | | | | | | | | | The 'rules' vector is made up of all the individual {env,config,...}Rules vectors under mutex protection whenever init() is called (only from the QCoreApplication ctor) or, at any time, by a call to QLoggingCategory:: setFilterRules(). Yet, the writes to the individual *Rules vectors were never protected by registryMutex, racing against the reads of the same vectors in the updateRules() function. Fix by protecting all access of all member variables with registryMutex. Add some strategic comments to make analysis easier for the next guy. Change-Id: If68d15a553ec7038693574a34f10a39f4cd480e8 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> (cherry picked from commit 567abeaa04db2c30f0d9a5cb95e11d295ad88784) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray: fix appending an already-contained itemMarc Mutz2017-02-212-7/+30
| | | | | | | | | | | | | | | | Like the lvalue QVector::append() overload, when we reallocate, we need to take a copy of the function's argument because the reference will get stale upon reallocation. Add a test. [ChangeLog][QtCore][QVarLengthArray] Fixed a bug involving appending an item already in the container to the container again. Change-Id: I06eeed6cb383dd5924e47a302bb3d1666d04c8e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 0e3d6fe4f69955bf98e23a382caf5251e2b47ea0)
* PNG image handler: Avoid "invalid distance too far back" errorEirik Aavitsland2017-02-201-0/+6
| | | | | | | | | | | | | | | | For certain slightly miscoded png images, newer versions of libpng will trigger the mentioned zlib error and fail to read the image. This miscoding has until now been safely ignored by all png implementations, so such images exist in the wild, and users expect them to work. Since the cost of the workaround is only a missed opportunity of a tiny saving in memory usage during decoding, enable it. Task-number: QTBUG-58171 Change-Id: I820a9faef6d5b7af79c04404ebdceb48a096f29a Reviewed-by: André Klitzing <aklitzing@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 33ebe6009872229ceca4171e7e6934f919affc1f)
* QInputDialog: prevent crash in static get*() functions when parent gets deletedMarc Mutz2017-02-204-66/+131
| | | | | | | | | | | | | | | | | | | | | | | | As explained in https://blogs.kde.org/2009/03/26/how-crash-almost-every-qtkde-application-and-how-fix-it-0 creating dialogs on the stack is a bad idea if the application or the dialog's parent window can be closed by means other than user interaction (such as a timer or an IPC call). Since we cannot know whether Qt is used to build such an application, we must assume it is, create the dialog on the heap, and monitor its lifetime with a QPointer. Instead of using manual resource management, add a minimal implementation of QAutoPointer, and use that in all static get*() functions. Task-number: QTBUG-54693 Change-Id: I6157dca18608e02be1ea2c2defbc31641defc9d1 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit c876bb1f1333e47722e202b0916415e771137071)
* xcb: Allow to disable XInput 2 support by setting QT_XCB_NO_XI2 env varAlexander Volkov2017-02-181-1/+2
| | | | | | | | | | | Use of XInput 2 may result in regressions. For example we call XISelectEvents for each window every time a device plugs/unplugs. It causes significant delays when there are many native windows. Change-Id: I60b799bb667d0e4bca1f9c52cdaa07b04bcc749f Task-number: QTBUG-57013 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> (cherry picked from commit bee82432ebf37312ef28846722fbf925ef4f04c8)
* Remove the name cache from QMetaType::typeNameThiago Macieira2017-02-171-25/+14
| | | | | | | | | | | | | | | | It was unnecessary, since we only cached the static types, which are all generated by the macro anyway. The way it was implemented, this produced data races that are strictly-speaking UB, even if all the threads were writing the same values to the same data locations. This commit changes a little the code to simplify, since we're changing those lines anyway. Task-number: QTBUG-58851 Change-Id: Idc5061f7145940f987dffffd14a30047846e3113 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> (cherry picked from commit fb376e0fcc8d2d0a1731a588bfc6497d05e090e6)
* tst_QThreadPool: don't deadlock when a cancel() test failsMarc Mutz2017-02-151-0/+20
| | | | | | | | | | | | | | | | | | | | | | We keep the runnables from finishing by having them block on a QSemaphore::acquire() call inside run(). If we fail a test that precedes the call to sem.release() further into the test, the early return will cause the thread pool to be destroyed, which will then attempt to wait for the runnables to finished, which, in turn wait for the semaphore to be released. -> dead lock Fix by introducing a RAII object to release the semaphore with a sufficiently large number to unblock all runnables. That number will in some situations be too large, but that does not matter. Change-Id: I1ec7e29b37bc36309e93e6e30708cc7db3c9579c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit b4689401a5ea142c9e2136b77d9193792874400a)
* Wait for runnables to start up in tst_QThreadPool::cancel()Marc Mutz2017-02-151-3/+10
| | | | | | | | | | | In order to get reproducible runs of the test, we need to wait in the main thread until all runnables have started executing. Otherwise, what the cancel() loop below actually does will vary from run to run. Change-Id: Ib912b0943e7bbd55c9480ae6fd4011ba20ac457e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 410a14cc768ad084a4e474ffd8b61471405fce0f)
* tst_QThreadPool: simplify cancel()Marc Mutz2017-02-151-5/+8
| | | | | | | | | | | | Instead of allocating a statically-sized array on the heap, use an automatic C array instead. Replace some magic numbers with named constants. Change-Id: I17d29a76a67c4a413453ac26a5dee8cd54a8a37d Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 8087ea67b1457db5da5a641628a11a84a3a119f2) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix UB (data race) in tst_QThreadPool::cancel()Marc Mutz2017-02-151-10/+17
| | | | | | | | | | | | Manipulating a simple int from multiple threads is a data race, thus undefined behavior. Fix by using QAtomicInt and atomic operations instead. Change-Id: I5418bc260da57fe353a71b8e5c7c1c97adbe7597 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit dcf74bdec83ba450b2016081339f48ac7469e1f5) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows QPA: Call InvalidateRect() in WM_PAINT/GL Software renderingFriedemann Kleint2017-02-141-1/+15
| | | | | | | | | | | Bring back the call to InvalidateRect() removed by change 6086c81e4d999d88ce4d412 since it seems that GL Software rendering requires it (also for single buffer mode). Task-number: QTBUG-58178 Change-Id: I197a1b3c3906c4afa43943db30dbc07dfb656cc7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 7780ee9e5f20f80ab9e053058d0b6d92586cf876)
* Fix detection of WinCE SDKs with MSVC2015Tobias Koenig2017-02-101-0/+5
| | | | | | | | | Add 'V140' to the list of search directories, that is where MSVC2015 installs the WinCE SDKs to. Change-Id: If7bbc6a8d58b49b9ee8c27159a96d445e74b8dab Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
* QStringMatcher: fix setCaseSensitivity() on a non-QString-backed matcherMarc Mutz2017-02-082-3/+12
| | | | | | | | | | | | | | | | | | | | | | When a non-QString-backed mode (via the (QChar*, int) ctor) was added for Qt 4.5, the author forgot to adjust the setCaseSensitivity() function. It still uses q_pattern instead of (p.uc, p.len) as the pattern for which to create the skip-table. Since there is no setPattern() overload for this mode, the correctness of the matcher is not harmed by this, but its performance degrades to that of a linear scan: the skip-table, being filled from an empty pattern, will be all-zeros, sending bm_find() into the 'possible match' case at every character. Since matching is still correct, but slow, it's not possible to write a test for this. I did, however, leave my attempts in the auto-test, for when we add QStringView overloads of setPattern() which will then be able to expose the bug. Change-Id: I7b803e8624b0352a0a974900affbbfc0c260d93b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 9e5e30fa130e43524d9ff26493023ac966a878cc)
* Unbreak ubsan developer-buildMarc Mutz2017-02-083-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | Clang 3.8's undefined-behavior sanitizer checks that the declared type of the object is a base class of the dynamic type of the object on each access to a member of a class type. It therefore requires the typeinfo for these types, which for polymorphic types is emitted in the TU where the vtable is emitted, too. QDBusConnectionPrivate is a polymorphic non-exported class, so this failed at link-time. Ditto for the other case. Fix by autotest-exporting the classes. Also, where applicable, de-inline the dtors, so the vtable (and typeinfo) are pinned to one TU, and the ctor, just because it's the correct thing to do. Change-Id: I991f81f88d2a48e85d94d9f3ac61473c0b7056d3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit dbc3d8e15e7a158b540370d9f864fafdb55eddb4)