Skip to content
Permalink
Browse files

Fix crash when backing through QgsPanelWidgetStack breadcrumbs

  • Loading branch information
nyalldawson committed Jun 27, 2016
1 parent 3b1d4e2 commit 861017547bd8b9d26553daa4475fbc8f0e58917c
Showing with 10 additions and 10 deletions.
  1. +10 −8 src/gui/qgspanelwidget.cpp
  2. +0 −2 src/ui/styledock/qgsrenderercontainerbase.ui
@@ -88,8 +88,7 @@ QgsPanelWidgetStack::QgsPanelWidgetStack( QWidget *parent )
: QWidget( parent )
{
setupUi( this );
mBackButton->hide();
mTitleText->hide();
clear();

connect( mBackButton, SIGNAL( pressed() ), this, SLOT( acceptCurrentPanel() ) );
}
@@ -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();
@@ -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>

0 comments on commit 8610175

Please sign in to comment.
You can’t perform that action at this time.