Skip to content

Commit

Permalink
Fix classes which violate rule of three, by implementing required
Browse files Browse the repository at this point in the history
copy/= operators or making them private

This revealed (and fixes) some issues, including a potential crash
using server access control (refs #13919), and a potential crash with
diagrams
  • Loading branch information
nyalldawson committed Jan 22, 2016
1 parent a16535a commit 752f6bd
Show file tree
Hide file tree
Showing 78 changed files with 324 additions and 75 deletions.
5 changes: 5 additions & 0 deletions python/analysis/raster/qgsrastercalcnode.sip
Expand Up @@ -71,4 +71,9 @@ class QgsRasterCalcNode
// bool calculate( QMap<QString, QgsRasterMatrix*>& rasterData, QgsRasterMatrix& result ) const /Deprecated/;

static QgsRasterCalcNode* parseRasterCalcString( const QString& str, QString& parserErrorMsg ) /Factory/;

private:

QgsRasterCalcNode( const QgsRasterCalcNode& rh );

};
4 changes: 4 additions & 0 deletions python/analysis/raster/qgsrelief.sip
Expand Up @@ -35,4 +35,8 @@ class QgsRelief

/** Write frequency of elevation values to file for manual inspection*/
bool exportFrequencyDistributionToCsv( const QString& file );

private:

QgsRelief( const QgsRelief& rh );
};
4 changes: 4 additions & 0 deletions python/core/gps/qgsgpsconnectionregistry.sip
Expand Up @@ -17,4 +17,8 @@ class QgsGPSConnectionRegistry {

protected:
QgsGPSConnectionRegistry();

private:

QgsGPSConnectionRegistry( const QgsGPSConnectionRegistry& rh );
};
5 changes: 5 additions & 0 deletions python/core/qgscrscache.sip
Expand Up @@ -12,6 +12,10 @@ class QgsCoordinateTransformCache
const QgsCoordinateTransform* transform( const QString& srcAuthId, const QString& destAuthId, int srcDatumTransform = -1, int destDatumTransform = -1 );
/** Removes transformations where a changed crs is involved from the cache*/
void invalidateCrs( const QString& crsAuthId );

private:

QgsCoordinateTransformCache( const QgsCoordinateTransformCache& rh );
};

class QgsCRSCache
Expand All @@ -31,4 +35,5 @@ class QgsCRSCache

protected:
QgsCRSCache();

};
1 change: 1 addition & 0 deletions python/core/qgsdataitemproviderregistry.sip
Expand Up @@ -21,5 +21,6 @@ class QgsDataItemProviderRegistry

private:
QgsDataItemProviderRegistry();
QgsDataItemProviderRegistry( const QgsDataItemProviderRegistry& rh );

};
1 change: 1 addition & 0 deletions python/core/qgsdiagramrendererv2.sip
Expand Up @@ -24,6 +24,7 @@ struct QgsDiagramLayerSettings
};

QgsDiagramLayerSettings();
QgsDiagramLayerSettings( const QgsDiagramLayerSettings& rh );

~QgsDiagramLayerSettings();

Expand Down
4 changes: 4 additions & 0 deletions python/core/qgsexpression.sip
Expand Up @@ -632,6 +632,10 @@ class QgsExpression
//protected:
QgsExpression::Node* mWhenExp;
QgsExpression::Node* mThenExp;

private:
WhenThen( const QgsExpression::WhenThen& rh );

};

class NodeCondition : QgsExpression::Node
Expand Down
1 change: 1 addition & 0 deletions python/core/qgslabel.sip
Expand Up @@ -104,4 +104,5 @@ class QgsLabel

private:
QgsLabel (); // pretend that constructor is private for now
QgsLabel( const QgsLabel& rh );
};
4 changes: 4 additions & 0 deletions python/core/qgslabelsearchtree.sip
Expand Up @@ -28,4 +28,8 @@ class QgsLabelSearchTree
* @note not available in python bindings
*/
// bool insertLabel( LabelPosition* labelPos, int featureId, const QString& layerName, bool diagram = false, bool pinned = false );

private:

QgsLabelSearchTree( const QgsLabelSearchTree& rh );
};
2 changes: 2 additions & 0 deletions python/core/qgspluginlayerregistry.sip
Expand Up @@ -64,4 +64,6 @@ class QgsPluginLayerRegistry

/** Private since instance() creates it */
QgsPluginLayerRegistry();
QgsPluginLayerRegistry( const QgsPluginLayerRegistry& rh );

};
1 change: 1 addition & 0 deletions python/core/qgsrendercontext.sip
Expand Up @@ -8,6 +8,7 @@ class QgsRenderContext

public:
QgsRenderContext();
QgsRenderContext( const QgsRenderContext& rh );
~QgsRenderContext();

//! Enumeration of flags that affect rendering operations
Expand Down
2 changes: 0 additions & 2 deletions python/core/qgssimplifymethod.sip
Expand Up @@ -18,8 +18,6 @@ class QgsSimplifyMethod

//! construct a default method
QgsSimplifyMethod();
//! copy constructor
QgsSimplifyMethod( const QgsSimplifyMethod& rh );

//! Sets the simplification type
void setMethodType( MethodType methodType );
Expand Down
4 changes: 4 additions & 0 deletions python/core/qgsvectorfilewriter.sip
Expand Up @@ -261,4 +261,8 @@ class QgsVectorFileWriter
protected:
//! @note not available in python bindings
// OGRGeometryH createEmptyGeometry( QGis::WkbType wkbType );

private:

QgsVectorFileWriter( const QgsVectorFileWriter& rh );
};
4 changes: 4 additions & 0 deletions python/core/qgsvectorlayerimport.sip
Expand Up @@ -76,4 +76,8 @@ class QProgressDialog;

/** Create index */
bool createSpatialIndex();

private:

QgsVectorLayerImport( const QgsVectorLayerImport& rh );
};
7 changes: 6 additions & 1 deletion python/core/raster/qgsrasterpipe.sip
Expand Up @@ -24,7 +24,8 @@ class QgsRasterPipe
};

QgsRasterPipe();
QgsRasterPipe( const QgsRasterPipe& thePipe );
//made private for python bindings
//QgsRasterPipe( const QgsRasterPipe& thePipe );

~QgsRasterPipe();

Expand Down Expand Up @@ -80,4 +81,8 @@ class QgsRasterPipe
QgsRasterProjector * projector() const;
QgsRasterNuller * nuller() const;

private:

QgsRasterPipe( const QgsRasterPipe& thePipe );

};
4 changes: 4 additions & 0 deletions python/core/raster/qgsrastershader.sip
Expand Up @@ -47,4 +47,8 @@ class QgsRasterShader
void writeXML( QDomDocument& doc, QDomElement& parent ) const;

void readXML( const QDomElement& elem );

private:

QgsRasterShader( const QgsRasterShader& rh );
};
4 changes: 4 additions & 0 deletions python/core/symbology-ng/qgscptcityarchive.sip
Expand Up @@ -36,6 +36,10 @@ class QgsCptCityArchive
// items
QVector< QgsCptCityDataItem* > rootItems() const;
QVector< QgsCptCityDataItem* > selectionItems() const;

private:

QgsCptCityArchive( const QgsCptCityArchive& rh );
};

/** Base class for all items in the model */
Expand Down
5 changes: 5 additions & 0 deletions python/core/symbology-ng/qgsrulebasedrendererv2.sip
Expand Up @@ -306,6 +306,11 @@ class QgsRuleBasedRendererV2 : QgsFeatureRendererV2

protected:
void initFilter();

private:

Rule( const QgsRuleBasedRendererV2::Rule& rh );

};

/////
Expand Down
5 changes: 5 additions & 0 deletions python/core/symbology-ng/qgssvgcache.sip
Expand Up @@ -48,6 +48,10 @@ class QgsSvgCacheEntry
bool operator==( const QgsSvgCacheEntry& other ) const;
/** Return memory usage in bytes*/
int dataSize() const;

private:

QgsSvgCacheEntry( const QgsSvgCacheEntry& rh );
};

/** A cache for images / pictures derived from svg files. This class supports parameter replacement in svg files
Expand Down Expand Up @@ -195,4 +199,5 @@ class QgsSvgCache : QObject

//Removes entry from the ordered list (but does not delete the entry itself)
void takeEntryFromList( QgsSvgCacheEntry* entry );

};
4 changes: 4 additions & 0 deletions python/core/symbology-ng/qgssymbolv2.sip
Expand Up @@ -305,6 +305,10 @@ class QgsSymbolV2RenderContext
* @param contextScope An expression scope for details about this symbol
*/
void setExpressionContextScope( QgsExpressionContextScope* contextScope /Transfer/);

private:

QgsSymbolV2RenderContext( const QgsSymbolV2RenderContext& rh );
};


Expand Down
4 changes: 4 additions & 0 deletions python/gui/qgsmapcanvassnapper.sip
Expand Up @@ -42,4 +42,8 @@ class QgsMapCanvasSnapper
int snapToBackgroundLayers( const QPoint& p, QList<QgsSnappingResult>& results /Out/, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() );

void setMapCanvas( QgsMapCanvas* canvas );

private:

QgsMapCanvasSnapper( const QgsMapCanvasSnapper& rh );
};
3 changes: 3 additions & 0 deletions python/server/qgswcsprojectparser.sip
Expand Up @@ -34,5 +34,8 @@ class QgsWCSProjectParser
void describeCoverage( const QString& aCoveName, QDomElement& parentElement, QDomDocument& doc ) const;
QList<QgsMapLayer*> mapLayerFromCoverage( const QString& cName, bool useCache = true ) const;

private:

QgsWCSProjectParser( const QgsWCSProjectParser& rh );
};

4 changes: 4 additions & 0 deletions python/server/qgswfsprojectparser.sip
Expand Up @@ -44,4 +44,8 @@ class QgsWFSProjectParser
QSet<QString> wfstInsertLayers() const;
QSet<QString> wfstDeleteLayers() const;

private:

QgsWFSProjectParser( const QgsWFSProjectParser& rh );

};
3 changes: 3 additions & 0 deletions src/analysis/raster/qgsrastercalcnode.h
Expand Up @@ -103,6 +103,9 @@ class ANALYSIS_EXPORT QgsRasterCalcNode
QString mRasterName;
QgsRasterMatrix* mMatrix;
Operator mOperator;

QgsRasterCalcNode( const QgsRasterCalcNode& rh );
QgsRasterCalcNode& operator=( const QgsRasterCalcNode& rh );
};


Expand Down
3 changes: 3 additions & 0 deletions src/analysis/raster/qgsrelief.h
Expand Up @@ -116,6 +116,9 @@ class ANALYSIS_EXPORT QgsRelief
@param b y value for x=0
*/
bool calculateRegression( const QList< QPair < int, double > >& input, double& a, double& b );

QgsRelief( const QgsRelief& rh );
QgsRelief& operator=( const QgsRelief& rh );
};

#endif // QGSRELIEF_H
5 changes: 5 additions & 0 deletions src/app/nodetool/qgsvertexentry.h
Expand Up @@ -51,6 +51,11 @@ class QgsVertexEntry
void placeMarker();

void setSelected( bool selected = true );

private:

QgsVertexEntry( const QgsVertexEntry& rh );
QgsVertexEntry& operator=( const QgsVertexEntry& rh );
};

#endif
3 changes: 3 additions & 0 deletions src/app/qgsidentifyresultsdialog.h
Expand Up @@ -105,6 +105,9 @@ class APP_EXPORT QgsIdentifyPlotCurve

private:
QwtPlotCurve* mPlotCurve;

QgsIdentifyPlotCurve( const QgsIdentifyPlotCurve& rh );
QgsIdentifyPlotCurve& operator=( const QgsIdentifyPlotCurve& rh );
};

class APP_EXPORT QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdentifyResultsBase
Expand Down
2 changes: 1 addition & 1 deletion src/core/diagram/qgstextdiagram.cpp
Expand Up @@ -118,7 +118,7 @@ void QgsTextDiagram::renderDiagram( const QgsFeature& feature, QgsRenderContext&
double baseX = position.x();
double baseY = position.y() - h;

QList<QPointF> textPositions; //midpoints for text placement
QVector<QPointF> textPositions; //midpoints for text placement
int nCategories = s.categoryAttributes.size();
for ( int i = 0; i < nCategories; ++i )
{
Expand Down
5 changes: 5 additions & 0 deletions src/core/geometry/qgsgeos.cpp
Expand Up @@ -95,6 +95,11 @@ class GEOSInit
{
finishGEOS_r( ctxt );
}

private:

GEOSInit( const GEOSInit& rh );
GEOSInit& operator=( const GEOSInit& rh );
};

static GEOSInit geosinit;
Expand Down
5 changes: 5 additions & 0 deletions src/core/gps/qgsgpsconnectionregistry.h
Expand Up @@ -44,6 +44,11 @@ class CORE_EXPORT QgsGPSConnectionRegistry
static QgsGPSConnectionRegistry* mInstance;

QSet<QgsGPSConnection*> mConnections;

private:

QgsGPSConnectionRegistry( const QgsGPSConnectionRegistry& rh );
QgsGPSConnectionRegistry& operator=( const QgsGPSConnectionRegistry& rh );
};

#endif // QGSGPSCONNECTIONREGISTRY_H
4 changes: 4 additions & 0 deletions src/core/pal/feature.h
Expand Up @@ -73,6 +73,10 @@ namespace pal
double label_height;
int char_num;
CharacterInfo* char_info;
private:

LabelInfo( const LabelInfo& rh );
LabelInfo& operator=( const LabelInfo& rh );
};

class LabelPosition;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgis.h