Skip to content
Permalink
Browse files

Fix crash when editing graduated symbol in style dock

Fixes #18909
  • Loading branch information
nyalldawson committed Jul 20, 2018
1 parent 1af00e3 commit 9887508d1ed557a1a6371f2c687449a856b00d40
@@ -28,6 +28,7 @@ Symbol selector widget that can be used to select and build a symbol
%End
public:


QgsSymbolSelectorWidget( QgsSymbol *symbol, QgsStyle *style, QgsVectorLayer *vl, QWidget *parent /TransferThis/ = 0 );
%Docstring
Symbol selector widget that can be used to select and build a symbol
@@ -548,6 +548,8 @@ void QgsCategorizedSymbolRendererWidget::changeCategorizedSymbol()
std::unique_ptr<QgsSymbol> newSymbol( mCategorizedSymbol->clone() );
if ( panel && panel->dockMode() )
{
// bit tricky here - the widget doesn't take ownership of the symbol. So we need it to last for the duration of the
// panel's existence. Accordingly, just kinda give it ownership here, and clean up in cleanUpSymbolSelector
QgsSymbolSelectorWidget *dlg = new QgsSymbolSelectorWidget( newSymbol.release(), mStyle, mLayer, panel );
dlg->setContext( mContext );
connect( dlg, &QgsPanelWidget::widgetChanged, this, &QgsCategorizedSymbolRendererWidget::updateSymbolsFromWidget );
@@ -977,7 +977,9 @@ void QgsGraduatedSymbolRendererWidget::changeRangeSymbol( int rangeIdx )
QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this );
if ( panel && panel->dockMode() )
{
QgsSymbolSelectorWidget *dlg = new QgsSymbolSelectorWidget( newSymbol.get(), mStyle, mLayer, panel );
// bit tricky here - the widget doesn't take ownership of the symbol. So we need it to last for the duration of the
// panel's existence. Accordingly, just kinda give it ownership here, and clean up in cleanUpSymbolSelector
QgsSymbolSelectorWidget *dlg = new QgsSymbolSelectorWidget( newSymbol.release(), mStyle, mLayer, panel );
dlg->setContext( mContext );
connect( dlg, &QgsPanelWidget::widgetChanged, this, &QgsGraduatedSymbolRendererWidget::updateSymbolsFromWidget );
connect( dlg, &QgsPanelWidget::panelAccepted, this, &QgsGraduatedSymbolRendererWidget::cleanUpSymbolSelector );
@@ -93,6 +93,8 @@ class GUI_EXPORT QgsSymbolSelectorWidget: public QgsPanelWidget, private Ui::Qgs

public:

// TODO QGIS 4.0 - transfer ownership of symbol to widget!

/**
* Symbol selector widget that can be used to select and build a symbol
* \param symbol The symbol to load into the widget as a start point.

0 comments on commit 9887508

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