diff options
| author | Jan Arve Saether <jan-arve.saether@digia.com> | 2013-04-23 15:04:26 +0200 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-23 18:57:45 +0200 |
| commit | 146658a10f290603470b800d71b778239e764312 (patch) | |
| tree | 16fda054a6b36993cb43adc9a49b4c96c53b07e9 /src/widgets/kernel/qgridlayout.cpp | |
| parent | ad3b61554b56435dd44563fec21d944416dd1c84 (diff) | |
| download | qtbase-146658a10f290603470b800d71b778239e764312.tar.gz | |
Fixed QLayout::addChildLayout(QLayout *l) when l had a parent
Previously if l had a parent, addChildLayout would warn and skip the
reparenting, but it would still add the sub layout to the layout.
This caused some inconsistencies in the hierarchy which in worst case
could cause crashes.
Task-number: QTBUG-30758
Change-Id: I618ec3341636b97bd71e421201b22c746dcf43e1
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/widgets/kernel/qgridlayout.cpp')
| -rw-r--r-- | src/widgets/kernel/qgridlayout.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index 12049f3303..96820e3891 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -1505,7 +1505,8 @@ void QGridLayout::addWidget(QWidget *widget, int fromRow, int fromColumn, void QGridLayout::addLayout(QLayout *layout, int row, int column, Qt::Alignment alignment) { Q_D(QGridLayout); - addChildLayout(layout); + if (!adoptLayout(layout)) + return; QGridBox *b = new QGridBox(layout); b->setAlignment(alignment); d->add(b, row, column); @@ -1524,7 +1525,8 @@ void QGridLayout::addLayout(QLayout *layout, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment) { Q_D(QGridLayout); - addChildLayout(layout); + if (!adoptLayout(layout)) + return; QGridBox *b = new QGridBox(layout); b->setAlignment(alignment); d->add(b, row, (rowSpan < 0) ? -1 : row + rowSpan - 1, column, (columnSpan < 0) ? -1 : column + columnSpan - 1); |
