Skip to content

Commit

Permalink
When a layer is being removed from the project, gracefully
Browse files Browse the repository at this point in the history
close and cleanup all panels in the layer styling dock

Fixes #38920

(cherry picked from commit 67ec244)
  • Loading branch information
nyalldawson committed Oct 23, 2020
1 parent 0d4f0a3 commit fb6643e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/qgslayerstylingwidget.cpp
Expand Up @@ -132,6 +132,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 );
Expand Down Expand Up @@ -602,6 +605,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 );
}
Expand Down

0 comments on commit fb6643e

Please sign in to comment.