Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
6.4.2
-
None
Description
Reproducer script attached.
Essentially, when displaying a QBoxLayout that has had two widgets inserted, using the following two calls:
layout.insertWidget(0, label0); layout.insertWidget(2, label2);
there is an access violation memory error (0xc0000005) when attempting to calculate the layout geometry on show.
I don't know if this is supposed to be supported. The behaviour when calling `insertWidget` with a positive index outside the list range is not documented. I can say that on Qt5.15, this worked, because the second call above would end up appending to the layout (at position 1), rather than inserting at position 2. This meant the layout had two sequential entries.
I can work around this on our app. But I think this behaviour should probably either be fixed or explicitly documented as unsupported.
Relevant part of stack trace:
Unhandled exception at 0x00007FF9CDCCAC80 (Qt6Widgets.dll) in app.exe.14916.dmp: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF. Qt6Widgets.dll!QLayout::activateRecursiveHelper(QLayoutItem * item) Line 952 Qt6Widgets.dll!QLayout::activateRecursiveHelper(QLayoutItem * item) Line 957 Qt6Widgets.dll!QLayout::activate() Line 1012 Qt6Widgets.dll!QWidgetPrivate::setVisible(bool visible) Line 8283
Found in Qt 6.4.2, not tested on more recent versions but I can't see any cases for this.