QBoxLayout: Remove unconventional try/catch blocks

These appear in insertSpacing() and insertWidget() only
and without any justification of why they may be needed.
Several other instances of the pattern these try/catch
blocks were guarding, i.e. allocate new QBoxLayoutItem
and insert to the list of items, were left unguarded,
leading us to believe this may not be useful at all and
can be safely removed.

Change-Id: I887fbde9d10e10f4f5daaa37f6f2892bd4038d58
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
bb10
Gabriel de Dietrich 2017-03-01 12:50:58 -08:00
parent 7bfe093ae5
commit f874b6e995
1 changed files with 5 additions and 23 deletions

View File

@ -873,15 +873,9 @@ void QBoxLayout::insertSpacing(int index, int size)
else
b = QLayoutPrivate::createSpacerItem(this, 0, size, QSizePolicy::Minimum, QSizePolicy::Fixed);
QT_TRY {
QBoxLayoutItem *it = new QBoxLayoutItem(b);
it->magic = true;
d->list.insert(index, it);
} QT_CATCH(...) {
delete b;
QT_RETHROW;
}
QBoxLayoutItem *it = new QBoxLayoutItem(b);
it->magic = true;
d->list.insert(index, it);
invalidate();
}
@ -985,20 +979,8 @@ void QBoxLayout::insertWidget(int index, QWidget *widget, int stretch,
QWidgetItem *b = QLayoutPrivate::createWidgetItem(this, widget);
b->setAlignment(alignment);
QBoxLayoutItem *it;
QT_TRY{
it = new QBoxLayoutItem(b, stretch);
} QT_CATCH(...) {
delete b;
QT_RETHROW;
}
QT_TRY{
d->list.insert(index, it);
} QT_CATCH(...) {
delete it;
QT_RETHROW;
}
QBoxLayoutItem *it = new QBoxLayoutItem(b, stretch);
d->list.insert(index, it);
invalidate();
}