diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-03-01 12:50:58 -0800 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-03-02 18:19:20 +0000 |
commit | f874b6e995646aaa7b43758ef2fe03ea1f60640b (patch) | |
tree | a66fb13dd61a558d3ec573690496f98dde895b07 /src/widgets/kernel | |
parent | 7bfe093ae5a904c375ae7b2635e681ff319c80af (diff) |
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>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qboxlayout.cpp | 28 |
1 files changed, 5 insertions, 23 deletions
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(); } |