Commit message (Collapse)AuthorAgeFilesLines
* Fix binary compatibility with old generated moc filesOlivier Goffart2018-09-151-1/+2
Commit 1c623bc6d1c0a7ca52d81ca72c64f36898b3e12c introduced a new QMetaObject revision, which change the size of the QMetaEnum data. When looking up QMetaEnum in a QMetaObject, this size need to be checked for every different QMEtaObject from the hierarchy, not just the first one. Change-Id: I6f0d3982329822e15e284aef9b141d4c9ab351b9 Reviewed-by: David Faure <> Reviewed-by: Thiago Macieira <> Reviewed-by: Allan Sandfeld Jensen <>
* Fix documentation of Q_NAMESPACEOlivier Goffart2018-05-221-0/+1
We need to add the \relates command otherwise it won't appear in the documentation Change-Id: I134776c1528445761a7539cf687e4855d39eb7a7 Reviewed-by: BogDan Vatra <>
* Declare the operator| in the Qt namespace for QFlags in that namespacesOlivier Goffart2018-04-082-23/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a long overdue change so we don't break ADL of operator|. I think will not break source or binary compatibility. The problem is code like this: namespace Foo { struct MyStruct; MyStruct operator|(MyStruct, MyStruct); void someFunction() { fooLabel->setAlignement(Qt::AlignLeft | Qt::AlignTop) } } This would be an error before as ADL would find only the Foo::operator| and not the global one since the arguments are not in the global namespace. After this change, ADL works fine and this code compiles This bites people with misterious error, see questions on [ChangeLog][QtCore] QFlags's operator| for enum types in the Qt namespace are now declared in the Qt namespace itself. Change-Id: I021bce11ec1521b4d8795a2cf3084a0be1960804 Reviewed-by: Thiago Macieira <>
* QVariant: Avoid a memory allocation with custom typesOlivier Goffart2018-04-081-3/+10
Store big or un-movable custom type within the same memory region as the QVariant::PrivateShared. Makes tst_qvariant::bigClassVariantCreation 33% faster Change-Id: I60a757d1f0a9a02cf9ac36fb53a72426b2f8cfa8 Reviewed-by: Jędrzej Nowacki <>
* Fix MSVC2017 compilation with enabled relaxed constexpr on 32-bit targetOlivier Goffart2018-03-281-4/+6
The problem is that qCountLeadingZeroBits is calling qPopulationCount which is only conditionally constexpr, so qCountLeadingZeroBits can only be marked constexpr if qPopulationCount is also. On MSVC2017 64bit this is not a problem because it uses builtins function in this case. (which is not constexpr, but it works because the compiler is not forced to diagnose the problem because of the "?:" operator. The error being fixed is: qalgorithms.h(847): error C3615: constexpr function 'qCountLeadingZeroBits' cannot result in a constant expression qalgorithms.h(858): note: failure was caused by call of undefined function or one not declared 'constexpr' qalgorithms.h(858): note: see usage of 'qPopulationCount' Task-number: QTBUG-67259 Change-Id: I65a3dfae12ca49394bec14ffefdd41a07fee1c32 Reviewed-by: Thiago Macieira <>
* Test for leaks in QMetaObject::invoke with functorsOlivier Goffart2018-01-141-25/+55
Task-number: QTBUG-65462 Change-Id: Ifa9735f5610a6df3ceabd286a0321e87bbd05ca3 Reviewed-by: Thiago Macieira <>
* Pass the include paths to qdocOlivier Goffart2017-12-081-3/+3
Change-Id: Id97df15863e8499d879079b0df705c78c04ca521 Reviewed-by: Martin Smith <>
* moc: Restore compatibility with Qt 5.7's -b optionOlivier Goffart2017-10-241-0/+1
In Qt 5.7, it was possible to call moc "-bfoo.h" or "-b foo.h" and it had the same effect. With the port to QCommandLineOption, we broke the -b option as it was not annotated as a short option. (Regression in a7e3c17e755881aa3169a2bb662338bbd2c67512) Task-number: QTBUG-63706 Change-Id: I161d0f1a4e65d129063b5e8431802257677da19d Reviewed-by: Jake Petroules <> Reviewed-by: Thiago Macieira <>
* moc: don't use const_cast in qt_metacast generated codeOlivier Goffart2017-09-251-6/+5
qt_metacast is not const so there is no need to use const_cast. This fixes a warning in generated code. Task-number: QTBUG-63352 Change-Id: I0c37442ac268a654316bc0e7e04f77fb51cae019 Reviewed-by: Thiago Macieira <>
* Prevent qmake to run moc on qobjectdefs.hOlivier Goffart2017-07-051-0/+1
Change-Id: Ic453c88c36cbeb24f3dc4fa6b6b20aabe5d24e09 Reviewed-by: Oswald Buddenhagen <>
* Moc: Don't error out when parsing namespace __identifier(...)Olivier Goffart2017-06-192-0/+7
Present for example in the Windows's Atlbase.h header. We should not abort the compilation, just ignore that construct Task-number: QTBUG-56634 Change-Id: Id6e4c9f03cb1cef46e330f4fbcae80ce4f3730c6 Reviewed-by: Simon Hausmann <>
* moc: Don't error out when defining a keywordOlivier Goffart2017-06-062-7/+15
Normaly, in C++ It's not valid to define a keyword, but it turns out that some system header do, so we just silently accept it. [ChangeLog][moc] moc no longer errors out if a C++ keyword is #define'ed Task-number: QTBUG-61204 Change-Id: Ia4d3ff9c77b6ff261b6140c220cfb81bd13f1d6d Reviewed-by: Thiago Macieira <> Reviewed-by: Simon Hausmann <>
* QStackedLayout: Fix UB (invalid cast) in qt_wasDeleted()Olivier Goffart2017-05-302-1/+2
Fixup of commit b4995eb7491c1b4784a1bf48db834c11c42b8d9d. We can't call QWidgetPrivate::get(w) on a deleted QWidget, because of the call to the member function QWidget::d_func. We can however call QObjectPrivate::get since we still are in the QObject destructor. tst_qstackedlayout now pass without ubsan Warnings. Change-Id: I4e839a97ddbd1cf21435a8fca76523b98a1f7d9b Reviewed-by: Marc Mutz <>
* Fix UB in QSplitter::childEventOlivier Goffart2017-04-231-9/+10
| | | | | | | | | | | The widget might be in the QObject destructor when the event is received, so we can't static cast. There is no need to check for isWindow for ChildRemoved because it would not otherwise be on our list. Change-Id: Ifc0a2979f1f6720f1963399276a28ac4a3224fff Reviewed-by: Marc Mutz <> Reviewed-by: Giuseppe D'Angelo <>
* Fix UB in QStandardItemModelOlivier Goffart2017-04-232-21/+14
The destructor of QStandardItem needs to access the model. So we need to destroy them before the QStrandardItemModel gets destroyed. In the destructor of the private, it is already too late because we are already in the ~QObject Since the destructor of QStandardItemPrivate is now empty, remove it completely. There is no need for QStandardItemPrivate to have a virtual table as there are no class that inherit from it. Change-Id: Id6639e21f277f1c4e85c3f9bc720b4f29eb16c2c Reviewed-by: Marc Mutz <>
* Fix QMetaMethod::invoke and automatic type registrationOlivier Goffart2017-04-222-5/+36
This was simply not working for two reasons: - The index passed to QMetaObject::metacall was not right (there was an offset because of the return type) - If the registration succeeded, the arguments were not even initialized. The tests in tst_moc always called QMetaMethod::parameterType before calling invoke, which was properly registering the type. So this was not seen in the tests before. [ChangeLog][QtCore][QMetaMethod] Fixed crash in invoke() with QueuedConnection and types whose metatype gets automatically registered. Task-number: QTBUG-60185 Change-Id: I4247628484214fba0a8acc1813ed8f112f59c888 Reviewed-by: Thiago Macieira <>
* Add a few std::move in functions accepting slotsOlivier Goffart2017-04-295-14/+21
| | | | | | | | This allows the use of move-only function objects Task-number: QTBUG-60339 Change-Id: If3595fca338cf7f3039eb566cc02e4e73cd04c86 Reviewed-by: Thiago Macieira <>
* Support move-only function objects in QObject::connectOlivier Goffart2017-04-293-3/+45
[ChangeLog][QtCore][QObject] Added connect() support for move-only function objects. Task-number: QTBUG-60339 Change-Id: Iae5e48432bb64517b0607b0c2ba23931957f432e Reviewed-by: Thiago Macieira <>
* Fix UB in QWidgetEffectSourcePrivate::detachOlivier Goffart2017-04-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Delete the QGraphicsEffect from the QWidget destructor instead of from the QWidgetPrivate destructor. The destructor of QGraphicsEffect still access methods of the QWidget, but the QObjectPrivate being destroyed from ~QObject, the pointer is no longer a QWidget. Fix warning with UB sanitizer in tst_QWidget::setGraphicsEffect qwidget_p.h:900:23: runtime error: member call on address 0x000001d822c0 which does not point to an object of type 'QWidget' 0x000001d822c0: note: object is of type 'QObject' 00 00 00 00 b0 46 5f 40 e5 7f 00 00 00 23 d8 01 00 00 00 00 f0 e6 00 44 e5 7f 00 00 00 00 74 47 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QObject' #0 0x7fe54767db76 in QWidgetEffectSourcePrivate::detach() #1 0x7fe548f29815 in QGraphicsEffect::~QGraphicsEffect() #2 0x7fe548f2a1b7 in QGraphicsBlurEffect::~QGraphicsBlurEffect() #3 0x7fe548f2a208 in QGraphicsBlurEffect::~QGraphicsBlurEffect() #4 0x7fe5475cd463 in QWidgetPrivate::~QWidgetPrivate() #5 0x7fe5475ce62c in QWidgetPrivate::~QWidgetPrivate() #6 0x7fe5400d0dda in QObject::~QObject() #7 0x7fe54763d411 in QWidget::~QWidget() #8 0x7fe54763d7f4 in QWidget::~QWidget() #9 0x4cc309 in QScopedPointerDeleter<QWidget>::cleanup(QWidget*) #10 0x4cc309 in QScopedPointer<QWidget, QScopedPointerDeleter<QWidget> >::reset(QWidget*) #11 0x4cc309 in tst_QWidget::setGraphicsEffect() Change-Id: I19c049e979cfce2adda908af8336cb4adac8f6c4 Reviewed-by: Marc Mutz <>
* Fix UB in QLayout::childEventOlivier Goffart2017-04-191-22/+9
We can't just static_cast a child to QLayout, because the child might not be a QLayout, and even if it was, we might be called from the QObject destructor so we would not be a layout anymore. Instead we can just qobject_cast the deleted object to a QLayout and remove it from the layout with removeItem. This would not take in account the case where we would be called because the QLayout gets destroyed, so we handle this case from ~QLayout by removing ourself from the parent. Note that the comment in ~QLayout was wrong, as the layout gets destroyed explicitly from ~QWidget, not from ~QObject. Change-Id: I49c6f17a76f207b9d750b6e5d987469498b96b31 Reviewed-by: Marc Mutz <>
* DockWidgets: Allow to have floating dockwidgets side by sideOlivier Goffart2017-04-135-161/+354
| | | | | | | | | | | | | | | Based on what MS VisualStudio can do, allow to have. We can now drop the QDockWidgets on floating ones so that they are next to eachother This is activated when QMainWindow::GroupedDragging and QMainWindow::AllowNestedDocks are both set. [ChangeLog][QtWidgets][QDockWidget] When QMainWindow::GrouppedDragging and QMainWindow::AllowNestedDocks are both enabled, floating dock widgets acquired the ability to be dropped together side by side. Change-Id: I48765c72ef80ef15aa31b91ae582cbb01dea41d6 Reviewed-by: Sérgio Martins <>
* QMainWindow: move the separator handling in another classOlivier Goffart2017-04-133-238/+254
So it will be re-used by QDockWidgetGroupWindow The Layout template argument can be the QMainWindowLayout, or the QDockWidgetGroupLayout. They have a function dockAreaLayoutInfo which return a QDockAreaLayout* or a QDockAreaLayoutInfo*, respectively. These two class have the same interface as far as QMainWindowLayoutSeparatorHelper is concerned. (QDockAreaLayout forward most of its call to the relevant QDockAreaLayoutInfo) The code is mostly moved without modification, but there is a change in startSeparatorMove, because we don't have access to the layoutState to set the fallbackToSizeHints variable, so instead, we do that from QMainWindowLayout::hover. Change-Id: Ic5fa3ee2def3d0155195f751d4770b207732139f Reviewed-by: Sérgio Martins <>
* Windows QPA: don't resize fixed sized windows when changing screenOlivier Goffart2017-03-291-0/+3
This seems to give pretty good result when EnableHighDPIScaling is NOT set. But this seems to be worse when it's set. Task-number: QTBUG-58959 Change-Id: I8de5a6c3c8b6146b1cb8f89676463206af404083 Reviewed-by: Friedemann Kleint <> Reviewed-by: Anton Kudryavtsev <>
* QSslSocket: fix connection to a international domain nameOlivier Goffart2017-03-234-7/+58
RFC6125 section 6.4.2 specify we need to convert the IDN to ascii before comparison. Note that we don't need to toLower anymore because toAce takes care of it. Section 7.2 recommands that we dod not attempt to check for wildcard character embedded within the A-labels or U-labels of an internationalized domain name. So we reject names that contiains a '*' but starts with 'xn--'. Change-Id: Ib0830520a1f82bbf9fd11818718277a479527ee3 Reviewed-by: Timur Pocheptsov <>
* Fix floating dock widget having the wrong parentOlivier Goffart2017-03-221-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 <>
* tst_moc: fix include guardsOlivier Goffart2017-03-251-1/+1
Change-Id: I465c035cc741f94cb6737e86e33fbd1589ddaa8e Reviewed-by: Marc Mutz <>
* Fix crash in QWindowPrivate::applyCursor when screen is nullOlivier Goffart2017-03-162-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 <>
* QLockFile: Don't deadlock if the lock file has a mtime in the futureOlivier Goffart2017-03-104-2/+33
Stale Lock files in the future can happen in some situations. For exemple two computers with different clocks access the same file system. It could be that one of the timestamp is totaly off (several years into the future). [ChangeLog][QtCore][QLockFile] Fixed a deadlock occurring if a corrupted lock file's modification time is in the future. Change-Id: I8dac98a0e898c76bcef67f8c195e126c996b6add Reviewed-by: David Faure <>
* QDockAreaLayout: Simplify QDockAreaLayout::gapRectOlivier Goffart2017-03-222-47/+27
Merge with QDockAreaLayoutInfo::itemRect, so it can be re-used fromp the QDockWidgetGroupWindow layout. Change-Id: Ic072eceb786be394f96e378a3ade4462cd1043fd Reviewed-by: Sérgio Martins <>
* Windows QPA: Fix MinGW developer buildOlivier Goffart2017-03-211-1/+1
Fix warning: qwindowswindow.cpp: In member function 'void QWindowsWindow::setWindowState_sys(Qt::WindowStates)': qwindowswindow.cpp:1965:74: error: suggest parentheses around arithmetic in operand of '^' [-Werror=parentheses] if ((newState & Qt::WindowMinimized) && (oldState ^ newState & Qt::WindowMaximized)) This is actually a real bug. What was meant was to check if the Maximized flag was changed. This code path is for the case in which the windows becomes minimized, and the maximized state changed. Amends change a02959bb5b43a3f9d881e5213ceedf535202b6a1. Task-number: QTBUG-57882 Change-Id: I1cd32a7080240e4462d3cd4f129c6c1a08409996 Reviewed-by: Robin Burchell <>
* When changing screen, only update the font if dpi has changedOlivier Goffart2017-03-171-1/+2
Generally, this might avoid unnecessary work in a quite common case. But if high dpi scaling is set, the dpi (in logical pixels) does not change. However this event is sent before QGuiApplicationPrivate::processWindowScreenChangedEvent has had time to change the geometry, and might cause a problem in QMenu Amends f3a4b4258f2d207b5a8e73d62822a3afe1bf8a72. Task-number: QTBUG-59484 Change-Id: Ie4ceedcb0754613cf239ae86b225c4139b70d0cc Reviewed-by: Friedemann Kleint <>
* tst_QObject: Test if the new connect style works with multiple inheritanceOlivier Goffart2017-03-141-0/+108
Change-Id: I638630ef84a3aee98688dac000efd3dfa7472175 Reviewed-by: Thiago Macieira <>
* Fix UB in QFutureInterface: invalid casts from ResultStoreBase to ResultStore<>Olivier Goffart2017-03-065-145/+122
ResultStore never actually exists, only ResutStoreBase does. So casting to ResultStore<T> and calling its member functions is UB. Put the type dependent function as template member functions within ResultStoreBase and so we don't need QtPrivate::ResultStore anymore. Same goes for the iterator. Change-Id: I739b9d234ba2238977863df77fde3a4471a9abd2 Reviewed-by: Marc Mutz <>
* Fix UB in QWidgetItemV2::~QWidgetItemV2Olivier Goffart2017-03-021-1/+1
| | | | | | | | | We might get there because 'wid' is already partially deleted (called from ~QObject). In that case, it is an undefined behavior to call a QWidget member function on it. Use QObjectPrivate::get instead. Change-Id: I6da314bf8385684d1332aa031a2d92012941303b Reviewed-by: Marc Mutz <>
* QDialogButtonGroup: Fix removal of deleted buttonsOlivier Goffart2017-03-022-3/+21
As the destroyed() signal is emitted from ~QObject, it is not allowed to use static_cast to a QAbstractButton on that pointer anymore. And the qobject_cast will also fail which will keep a dangling pointer in the hash. Change-Id: If0d22fcc30cde87e771e70914c3afb04ea207289 Reviewed-by: Marc Mutz <>
* Fix UB in QWidgetResizeHandler::eventFilterOlivier Goffart2017-02-271-5/+6
Unconditional cast to a QMouseEvent while the event might also be a QKeyEvent. Change-Id: If5eb6fbad6e4440c167ff95298f51efde1834217 Reviewed-by: Marc Mutz <>
* moc: Support signals that return movable-only typeOlivier Goffart2017-03-133-12/+35
By adding std::move where it makes sense. This is not only good for move-only types, but for any type which can be moved as it saves copies of the return value in any case. [ChangeLog][moc] Move-only types are now supported as return types of signals and slots. Change-Id: Idc9453af993e7574a6bddd4a87210eddd3da48a9 Reviewed-by: Marc Mutz <>
* moc: put the QPrivateSignal argument in the arg arrayOlivier Goffart2017-03-132-6/+18
Even if it is normaly not used, templated code might still try to access it Task-number: QTBUG-59414 Change-Id: I9f7aadd714843059c8f89cdac48c60a3e2ca7294 Reviewed-by: Simon Hausmann <>
* Make QWindow's windowState a QFlags of the WindowStateOlivier Goffart2017-03-1635-334/+413
This reflects QWidget API, and restores some behavior from Qt4. Some WM can have several state at the same time. On Plasma for example, when a window is both maximized and minimized, the "maximized" checkbox is checked from the taskbar entry. The API of QPlatformWindow was changed to take a QFlag and the platform plugins were adapted. - On XCB: Always send the full state to the WM. And read the full state. - On Windows: The code was originally written with '&' in Qt4, and was changed to == when porting. Some adaptation had to be made so the states would be preserved. - On macOS: Only a single state can be set and is reported back for now, with the possibly to expand this in the future. - Other platforms: Just do as before with the effective state. Task-number: QTBUG-57882 Task-number: QTBUG-52616 Task-number: QTBUG-52555 Change-Id: I7a1f7cac64236bbd4c591f796374315639233dad Reviewed-by: Gunnar Sletta <> Reviewed-by: Robin Burchell <>
* Deprecate QSignalMapperOlivier Goffart2017-03-147-138/+34
Does not make much sense now that we can connect to lambda functions [ChangeLog][QtCore][QSignalMapper] QSignalMapper is now marked as deprecated. Change-Id: I89135f23fdf16b42142a125eb7c9a86084c90bfc Reviewed-by: Sze Howe Koh <>
* moc: Add support for C++17 nested namespaces (N4230)Olivier Goffart2017-03-084-2/+107
| | | | | | | [ChangeLog][moc] Added Support for C++17 nested namespaces Change-Id: Ib83fc5bf48f66546fa97b49710582fbf9c984503 Reviewed-by: Simon Hausmann <>
* moc: Fix parsing of digit separatorOlivier Goffart2017-03-082-8/+12
[ChangeLog][moc] Fixed parsing errors in presence of C++14 digit separators. Task-number: QTBUG-59351 Change-Id: Iea38ea7388853d84b819c2beb78a59371f57bf7d Reviewed-by: Simon Hausmann <>
* Windows QPA: Better recover from removed screens when fullscreenJocelyn Turcotte2017-03-081-4/+10
QWindowsWindow::handleResized would call isFullScreen_sys which checks if the window's screen geometry matches the one of the window. When switching back from fullscreen, Windows will have set the geometry to fill the next window, but we don't switch QScreen until later in that function, inside handleGeometryChange. This would result in our window to take the whole screen geometry, but the FullScreen state wouldn't be transferred to the new screen. Fix the issue by using screenForGeometry and check if we are fullscreen on any screen. Also make sure that we check the validity of m_savedFrameGeometry when restoring after a screen remove, since we would previously restore to an area not covered by any screen anymore. Change-Id: I43bc02738007918e9a26c1d27a699c51d3365034 Reviewed-by: Friedemann Kleint <>
* Remove unused src/tools/moc/mwerks_mac.* filesOlivier Goffart2017-03-062-281/+0
These files are unused. They still contains Qt3 code (QCString for example) Task-number: QTBUG-59302 Change-Id: I661f08db4092311df1d6c7d54b9780d86adab8aa Reviewed-by: Simon Hausmann <>
* Fix DPI of QWidget with parent on a different screenOlivier Goffart2017-03-022-11/+9
If a floating QWidget has a parent on a different screen, its DPI was still inherited from the parent instead of taken from the screen. The only reason we did was in case there is a customDpi set. (customDpi is a private thing that is only used in designer to change the appearance of the previewed widget) So instead of recursing into QWidget::metric for each ancestor, just use a for loop to find if one parent has a customDpi. If no customDpi is found, then return the DPI of the right screen. Task-number: QTBUG-58959 Task-number: QTBUG-48242 Change-Id: Ie6e9e48cdd10234994c0919ba3aea9b0cdb52494 Reviewed-by: Friedemann Kleint <> Reviewed-by: Simon Hausmann <>
* Doc: Remove references to pre-C++11 recommendationsOlivier Goffart2017-03-012-16/+2
Compiler support for lambda functions and variadic templates is required since Qt 5.7, so no need to mention in the documentation what happens if the compiler doesn't support it. Change-Id: I5caeaa0bd7f0edce81e22e22964e0b7dd042c719 Reviewed-by: Marc Mutz <>
* QDockWidget: Fix memory leak when dragging a tab outside of a floating tab ↵Olivier Goffart2017-02-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 <>
* Fix crash while dropping a tabbed group into a single floating QDockWidgetOlivier Goffart2017-02-212-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 <>
* QReadWriteLocker: Fix race in unlockOlivier Goffart2017-02-171-3/+3
An Acquire barrier in QReadWriteLocker::unlock was missing to synchronize with the testAndSetOrdered on d_ptr in the lock functions. The race is between the write of d->writerCount in tryLockForWrite, and the read in unlock. The acquire on d->mutex is not enough because it is not on the same object. While that race could be fixed by taking the newly-allocate()ed d's mutex before publishing it with testAndSet, there's another race, on 'recursive', between a newly-minted Private* with recursive == false in tryLockForWrite(), and the read of 'recursive' in unlock(). Task-number: QTBUG-58917 Change-Id: I10ba36573c0e57468d11e9b77d85045711feaea1 Reviewed-by: Marc Mutz <>
* Fix a race in QFreeListOlivier Goffart2017-02-171-2/+2
The _next variable need the acquire and release fence in next() to synchronize with the equivalent operations in release() (which already have the them) The ordering on the _v[block] is not enough as this does not synchronize the same object. Task-number: QTBUG-58917 Change-Id: I17cc39e6791433348b6227363dbea92bcf03700d Reviewed-by: David Faure <> Reviewed-by: Thiago Macieira <>