Skip to content
Permalink
Browse files
Fix for crash if removing a layer with a related composer attribute t…
…able

git-svn-id: http://svn.osgeo.org/qgis/trunk@13537 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 20, 2010
1 parent 2015db7 commit be83e1f1e369e05a05af3e14ade4779cc23eb26f
Showing with 16 additions and 1 deletion.
  1. +12 −1 src/core/composer/qgscomposerattributetable.cpp
  2. +4 −0 src/core/composer/qgscomposerattributetable.h
@@ -23,7 +23,7 @@
QgsComposerAttributeTable::QgsComposerAttributeTable( QgsComposition* composition ): QgsComposerTable( composition ), mVectorLayer( 0 ), mComposerMap( 0 ), \
mMaximumNumberOfFeatures( 5 ), mShowOnlyVisibleFeatures( true )
{

connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( removeLayer( const QString& ) ) );
}

QgsComposerAttributeTable::~QgsComposerAttributeTable()
@@ -145,6 +145,17 @@ QString QgsComposerAttributeTable::attributeDisplayName( int attributeIndex, con
}
}

void QgsComposerAttributeTable::removeLayer( QString layerId )
{
if ( mVectorLayer )
{
if ( layerId == mVectorLayer->getLayerID() )
{
mVectorLayer = 0;
}
}
}

void QgsComposerAttributeTable::setSceneRect( const QRectF& rectangle )
{
double titleHeight = 2 * mGridStrokeWidth + 2 * mLineTextDistance + fontAscentMillimeters( mHeaderFont );
@@ -84,6 +84,10 @@ class CORE_EXPORT QgsComposerAttributeTable: public QgsComposerTable
/**Returns the attribute name to display in the item (attribute name or an alias if present)*/
QString attributeDisplayName( int attributeIndex, const QString& name ) const;

private slots:
/**Checks if this vector layer will be removed (and sets mVectorLayer to 0 if yes) */
void removeLayer( QString layerId );

signals:
/**This signal is emitted if the maximum number of feature changes (interactively)*/
void maximumNumerOfFeaturesChanged( int n );

0 comments on commit be83e1f

Please sign in to comment.