From f874b6e995646aaa7b43758ef2fe03ea1f60640b Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 1 Mar 2017 12:50:58 -0800 Subject: 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 --- src/widgets/kernel/qboxlayout.cpp | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp index f2e3df5314..588cec2b95 100644 --- a/src/widgets/kernel/qboxlayout.cpp +++ b/src/widgets/kernel/qboxlayout.cpp @@ -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(); } -- cgit v1.2.3