Skip to content
Permalink
Browse files

When a layer is being removed from the project, gracefully

close and cleanup all panels in the layer styling dock

Fixes #38920
  • Loading branch information
nyalldawson committed Sep 22, 2020
1 parent fd771bb commit 67ec244864ca6f9290e1f35a1a0c60b4888fe686
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/app/qgslayerstylingwidget.cpp
@@ -142,6 +142,9 @@ void QgsLayerStylingWidget::setLayer( QgsMapLayer *layer )
if ( layer == mCurrentLayer )
return;

// when current layer is changed, apply the main panel stack to allow it to gracefully clean up
mWidgetStack->acceptAllPanels();

if ( mCurrentLayer )
{
disconnect( mCurrentLayer, &QgsMapLayer::styleChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer );
@@ -679,6 +682,9 @@ void QgsLayerStylingWidget::layerAboutToBeRemoved( QgsMapLayer *layer )
{
if ( layer == mCurrentLayer )
{
// when current layer is removed, apply the main panel stack to allow it to gracefully clean up
mWidgetStack->acceptAllPanels();

mAutoApplyTimer->stop();
setLayer( nullptr );
}

0 comments on commit 67ec244

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