From 60c1d40b2077df941a6d197b2d1ab0a711bc6316 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 10 Jan 2020 12:56:46 +0100 Subject: [PATCH] [libcalamaresui] Log which ViewStep is broken - a ViewStep with no widget will crash the application; print out its name before doing so. --- src/libcalamaresui/ViewManager.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 4721370b9..7492f1f8b 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -158,13 +158,6 @@ void ViewManager::insertViewStep( int before, ViewStep* step ) { m_steps.insert( before, step ); - QLayout* layout = step->widget()->layout(); - if ( layout ) - { - layout->setContentsMargins( 0, 0, 0, 0 ); - } - m_stack->insertWidget( before, step->widget() ); - connect( step, &ViewStep::enlarge, this, &ViewManager::enlarge ); connect( step, &ViewStep::nextStatusChanged, this, [this]( bool status ) { ViewStep* vs = qobject_cast< ViewStep* >( sender() ); @@ -177,6 +170,17 @@ ViewManager::insertViewStep( int before, ViewStep* step ) } } ); + if ( !step->widget() ) + { + cError() << "ViewStep" << step->moduleInstanceKey() << "has no widget."; + } + + QLayout* layout = step->widget()->layout(); + if ( layout ) + { + layout->setContentsMargins( 0, 0, 0, 0 ); + } + m_stack->insertWidget( before, step->widget() ); m_stack->setCurrentIndex( 0 ); step->widget()->setFocus(); }