Skip to content

Commit

Permalink
Fix crash when backing through QgsPanelWidgetStack breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 27, 2016
1 parent 3b1d4e2 commit 8610175
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 10 additions & 8 deletions src/gui/qgspanelwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ QgsPanelWidgetStack::QgsPanelWidgetStack( QWidget *parent )
: QWidget( parent )
{
setupUi( this );
mBackButton->hide();
mTitleText->hide();
clear();

connect( mBackButton, SIGNAL( pressed() ), this, SLOT( acceptCurrentPanel() ) );
}
Expand All @@ -116,18 +115,21 @@ QgsPanelWidget *QgsPanelWidgetStack::takeMainWidget()

void QgsPanelWidgetStack::clear()
{
// TODO Remove all widgets;
for ( int i = mStackedWidget->count(); i >= 0; i-- )
{
QgsPanelWidget* widget = qobject_cast<QgsPanelWidget*>( mStackedWidget->widget( i ) );
if ( widget )
if ( QgsPanelWidget* panelWidget = qobject_cast<QgsPanelWidget*>( mStackedWidget->widget( i ) ) )
{
mStackedWidget->removeWidget( widget );
if ( widget->autoDelete() )
mStackedWidget->removeWidget( panelWidget );
if ( panelWidget->autoDelete() )
{
widget->deleteLater();
panelWidget->deleteLater();
}
}
else if ( QWidget* widget = mStackedWidget->widget( i ) )
{
mStackedWidget->removeWidget( widget );
widget->deleteLater();
}
}
mTitles.clear();
mTitleText->hide();
Expand Down
2 changes: 0 additions & 2 deletions src/ui/styledock/qgsrenderercontainerbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
</property>
<item>
<widget class="QStackedWidget" name="mStackedWidget">
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 8610175

Please sign in to comment.