Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Completely remove QgsVectorLayerFeatureIterator::FetchJoinInfo::joinL…
…ayer and note in api_break.dox

There's no point in keeping such a dangerous member in the api
  • Loading branch information
nyalldawson committed Jun 3, 2021
1 parent cebb1f8 commit c57d7ad
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
2 changes: 2 additions & 0 deletions doc/api_break.dox
Expand Up @@ -31,6 +31,8 @@ setDataSource {#qgis_api_break_3_20_setdatasource}

- QgsMapLayer::setDataSource is no longer virtual. It has been replaced with QgsMapLayer::setDataSourcePrivate. This is only relevant for subclassing QgsMapLayer, for code that only uses the subclasses (QgsVectorLayer, QgsRasterLayer, ...) this has no effect.

- QgsVectorLayerFeatureIterator::FetchJoinInfo::joinLayer was removed. This layer pointer was dangerous and not safe to access in any situation.

QGIS 3.4 {#qgis_api_break_3_4}
========

Expand Down
Expand Up @@ -104,17 +104,12 @@ end of iterating: free the resources / lock
%End



struct FetchJoinInfo
{
const QgsVectorLayerJoinInfo *joinInfo;//!< Canonical source of information about the join
QgsAttributeList attributes; //!< Attributes to fetch
int indexOffset; //!< At what position the joined fields start

QgsVectorLayer *joinLayer /Deprecated/;


QgsFields joinLayerFields;

int targetField; //!< Index of field (of this layer) that drives the join
int joinField; //!< Index of field (of the joined layer) must have equal value
Expand All @@ -123,7 +118,6 @@ end of iterating: free the resources / lock
void addJoinedAttributesDirect( QgsFeature &f, const QVariant &joinValue ) const;
};


virtual bool isValid() const;


Expand Down
3 changes: 0 additions & 3 deletions src/core/vector/qgsvectorlayerfeatureiterator.cpp
Expand Up @@ -710,9 +710,6 @@ void QgsVectorLayerFeatureIterator::prepareJoin( int fieldIdx )
{
FetchJoinInfo info;
info.joinInfo = joinInfo;
Q_NOWARN_DEPRECATED_PUSH
info.joinLayer = joinLayer;
Q_NOWARN_DEPRECATED_POP
info.joinSource = std::make_shared< QgsVectorLayerFeatureSource >( joinLayer );
info.indexOffset = mSource->mJoinBuffer->joinedFieldsOffset( joinInfo, mSource->mFields );
info.targetField = mSource->mFields.indexFromName( joinInfo->targetFieldName() );
Expand Down
19 changes: 6 additions & 13 deletions src/core/vector/qgsvectorlayerfeatureiterator.h
Expand Up @@ -140,8 +140,6 @@ class CORE_EXPORT QgsVectorLayerFeatureIterator : public QgsAbstractFeatureItera

void setInterruptionChecker( QgsFeedback *interruptionChecker ) override SIP_SKIP;

Q_NOWARN_DEPRECATED_PUSH

/**
* Join information prepared for fast attribute id mapping in QgsVectorLayerJoinBuffer::updateFeatureAttributes().
* Created in the select() method of QgsVectorLayerJoinBuffer for the joins that contain fetched attributes
Expand All @@ -153,36 +151,31 @@ class CORE_EXPORT QgsVectorLayerFeatureIterator : public QgsAbstractFeatureItera
QMap<int, int> attributesSourceToDestLayerMap SIP_SKIP; //!< Mapping from original attribute index to the joined layer index
int indexOffset; //!< At what position the joined fields start

/**
* Resolved pointer to the joined layer
* \deprecated Do NOT use. This is not thread safe, and should never be accessed from a background thread.
*/
#ifndef SIP_RUN
Q_DECL_DEPRECATED QgsVectorLayer *joinLayer = nullptr;
#else
QgsVectorLayer *joinLayer SIP_DEPRECATED;
#endif

/**
* Feature source for join
*
* \note Not available in Python bindings
* \since QGIS 3.20
*/
std::shared_ptr< QgsVectorLayerFeatureSource > joinSource SIP_SKIP;
std::shared_ptr< QgsVectorLayerFeatureSource > joinSource;

/**
* Fields from joined layer.
*
* \note Not available in Python bindings
* \since QGIS 3.20
*/
QgsFields joinLayerFields;
#endif

int targetField; //!< Index of field (of this layer) that drives the join
int joinField; //!< Index of field (of the joined layer) must have equal value

void addJoinedAttributesCached( QgsFeature &f, const QVariant &joinValue ) const;
void addJoinedAttributesDirect( QgsFeature &f, const QVariant &joinValue ) const;
};
Q_NOWARN_DEPRECATED_POP


bool isValid() const override;

Expand Down

0 comments on commit c57d7ad

Please sign in to comment.