Skip to content
Permalink
Browse files

Fix accidental overwrite using wrong symbol settings

  • Loading branch information
nyalldawson committed Jul 29, 2020
1 parent a0e915f commit f48a79ca85edaf4deb2ce06a10b569db36d0d7d9
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/app/3d/qgssymbol3dwidget.cpp
@@ -156,6 +156,8 @@ void QgsSymbol3DWidget::saveSymbol()
if ( saveDlg.name().isEmpty() )
return;

std::unique_ptr< QgsAbstract3DSymbol > newSymbol( symbol() );

// check if there is no symbol with same name
if ( QgsStyle::defaultStyle()->symbol3DNames().contains( saveDlg.name() ) )
{
@@ -173,9 +175,9 @@ void QgsSymbol3DWidget::saveSymbol()
QStringList symbolTags = saveDlg.tags().split( ',' );

// add new symbol to style and re-populate the list
QgsAbstract3DSymbol *newSymbol = symbol();
QgsStyle::defaultStyle()->addSymbol3D( saveDlg.name(), newSymbol );
QgsAbstract3DSymbol *s = newSymbol.get();
QgsStyle::defaultStyle()->addSymbol3D( saveDlg.name(), newSymbol.release() );

// make sure the symbol is stored
QgsStyle::defaultStyle()->saveSymbol3D( saveDlg.name(), newSymbol, saveDlg.isFavorite(), symbolTags );
QgsStyle::defaultStyle()->saveSymbol3D( saveDlg.name(), s, saveDlg.isFavorite(), symbolTags );
}

0 comments on commit f48a79c

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