Skip to content
Permalink
Browse files
Extra safety for layer pointer
  • Loading branch information
nyalldawson committed Sep 7, 2021
1 parent 31d2ffe commit 2545b172b03591d2dcfd2287d13b801e735aa3fd
@@ -76,6 +76,9 @@ void QgsAnnotationItemPropertiesWidget::apply()

void QgsAnnotationItemPropertiesWidget::onChanged()
{
if ( !mLayer )
return;

// set the annotation layer's item's properties to match the widget
std::unique_ptr< QgsAnnotationItem > newItem( mItemWidget->createItem() );

@@ -84,6 +87,9 @@ void QgsAnnotationItemPropertiesWidget::onChanged()

void QgsAnnotationItemPropertiesWidget::setItemId( const QString &itemId )
{
if ( !mLayer )
return;

// try to retrieve matching item
bool setItem = false;
if ( QgsAnnotationItem *item = mLayer->item( itemId ) )
@@ -18,6 +18,7 @@

#include "qgsmaplayerconfigwidget.h"
#include "qgsmaplayerconfigwidgetfactory.h"
#include <QPointer>

class QgsAnnotationLayer;
class QgsAnnotationItemBaseWidget;
@@ -45,7 +46,7 @@ class QgsAnnotationItemPropertiesWidget : public QgsMapLayerConfigWidget
void setItemId( const QString &itemId );

QStackedWidget *mStack = nullptr;
QgsAnnotationLayer *mLayer = nullptr;
QPointer< QgsAnnotationLayer > mLayer;
QgsAnnotationItemBaseWidget *mItemWidget = nullptr;

};

0 comments on commit 2545b17

Please sign in to comment.