Skip to content
Permalink
Browse files

Fix classes which violate rule of three, by implementing required

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 752f6bd15066beb591058aa5201ebb38c225a112
Showing with 324 additions and 75 deletions.
  1. +5 −0 python/analysis/raster/qgsrastercalcnode.sip
  2. +4 −0 python/analysis/raster/qgsrelief.sip
  3. +4 −0 python/core/gps/qgsgpsconnectionregistry.sip
  4. +5 −0 python/core/qgscrscache.sip
  5. +1 −0 python/core/qgsdataitemproviderregistry.sip
  6. +1 −0 python/core/qgsdiagramrendererv2.sip
  7. +4 −0 python/core/qgsexpression.sip
  8. +1 −0 python/core/qgslabel.sip
  9. +4 −0 python/core/qgslabelsearchtree.sip
  10. +2 −0 python/core/qgspluginlayerregistry.sip
  11. +1 −0 python/core/qgsrendercontext.sip
  12. +0 −2 python/core/qgssimplifymethod.sip
  13. +4 −0 python/core/qgsvectorfilewriter.sip
  14. +4 −0 python/core/qgsvectorlayerimport.sip
  15. +6 −1 python/core/raster/qgsrasterpipe.sip
  16. +4 −0 python/core/raster/qgsrastershader.sip
  17. +4 −0 python/core/symbology-ng/qgscptcityarchive.sip
  18. +5 −0 python/core/symbology-ng/qgsrulebasedrendererv2.sip
  19. +5 −0 python/core/symbology-ng/qgssvgcache.sip
  20. +4 −0 python/core/symbology-ng/qgssymbolv2.sip
  21. +4 −0 python/gui/qgsmapcanvassnapper.sip
  22. +3 −0 python/server/qgswcsprojectparser.sip
  23. +4 −0 python/server/qgswfsprojectparser.sip
  24. +3 −0 src/analysis/raster/qgsrastercalcnode.h
  25. +3 −0 src/analysis/raster/qgsrelief.h
  26. +5 −0 src/app/nodetool/qgsvertexentry.h
  27. +3 −0 src/app/qgsidentifyresultsdialog.h
  28. +1 −1 src/core/diagram/qgstextdiagram.cpp
  29. +5 −0 src/core/geometry/qgsgeos.cpp
  30. +5 −0 src/core/gps/qgsgpsconnectionregistry.h
  31. +4 −0 src/core/pal/feature.h
  32. +1 −1 src/core/qgis.h
  33. +16 −16 src/core/qgsclipper.h
  34. +4 −0 src/core/qgscrscache.cpp
  35. +6 −0 src/core/qgscrscache.h
  36. +3 −0 src/core/qgsdataitemproviderregistry.h
  37. +35 −0 src/core/qgsdiagramrendererv2.cpp
  38. +3 −0 src/core/qgsdiagramrendererv2.h
  39. +4 −0 src/core/qgsexpression.h
  40. +3 −0 src/core/qgslabel.h
  41. +5 −0 src/core/qgslabelingenginev2.h
  42. +3 −0 src/core/qgslabelsearchtree.h
  43. +4 −4 src/core/qgslayerdefinition.cpp
  44. +5 −0 src/core/qgslocalec.h
  45. +2 −3 src/core/qgsmaprendererjob.cpp
  46. +2 −1 src/core/qgspallabeling.h
  47. +2 −0 src/core/qgspluginlayerregistry.h
  48. +1 −1 src/core/qgsproject.cpp
  49. +41 −0 src/core/qgsrendercontext.cpp
  50. +5 −0 src/core/qgsrendercontext.h
  51. +5 −0 src/core/qgsrulebasedlabeling.h
  52. +0 −15 src/core/qgssimplifymethod.cpp
  53. +0 −4 src/core/qgssimplifymethod.h
  54. +4 −0 src/core/qgsspatialindex.cpp
  55. +3 −0 src/core/qgsvectorfilewriter.h
  56. +5 −0 src/core/qgsvectorlayerimport.h
  57. +0 −14 src/core/qgsvectorsimplifymethod.cpp
  58. +0 −4 src/core/qgsvectorsimplifymethod.h
  59. +1 −1 src/core/qgsvirtuallayerdefinitionutils.cpp
  60. +2 −0 src/core/raster/qgsrasterpipe.h
  61. +3 −0 src/core/raster/qgsrastershader.h
  62. +2 −0 src/core/symbology-ng/qgscategorizedsymbolrendererv2.h
  63. +4 −0 src/core/symbology-ng/qgscptcityarchive.h
  64. +3 −3 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
  65. +2 −2 src/core/symbology-ng/qgsfillsymbollayerv2.h
  66. +2 −0 src/core/symbology-ng/qgsgraduatedsymbolrendererv2.h
  67. +5 −0 src/core/symbology-ng/qgsrulebasedrendererv2.h
  68. +5 −0 src/core/symbology-ng/qgssvgcache.h
  69. +3 −0 src/core/symbology-ng/qgssymbolv2.h
  70. +3 −0 src/gui/qgsmapcanvassnapper.h
  71. +3 −0 src/plugins/geometry_snapper/qgssnapindex.h
  72. +3 −0 src/plugins/spatialquery/qgsgeometrycoordinatetransform.h
  73. +3 −0 src/plugins/spatialquery/qgsspatialquery.h
  74. +2 −0 src/providers/postgres/qgspostgresconn.h
  75. +1 −1 src/providers/postgres/qgspostgresprovider.cpp
  76. +3 −0 src/server/qgswcsprojectparser.h
  77. +3 −0 src/server/qgswfsprojectparser.h
  78. +1 −1 src/server/qgswmsserver.cpp
@@ -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 );

};
@@ -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 );
};
@@ -17,4 +17,8 @@ class QgsGPSConnectionRegistry {

protected:
QgsGPSConnectionRegistry();

private:

QgsGPSConnectionRegistry( const QgsGPSConnectionRegistry& rh );
};
@@ -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
@@ -31,4 +35,5 @@ class QgsCRSCache

protected:
QgsCRSCache();

};
@@ -21,5 +21,6 @@ class QgsDataItemProviderRegistry

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

};
@@ -24,6 +24,7 @@ struct QgsDiagramLayerSettings
};

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

~QgsDiagramLayerSettings();

@@ -632,6 +632,10 @@ class QgsExpression
//protected:
QgsExpression::Node* mWhenExp;
QgsExpression::Node* mThenExp;

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

};

class NodeCondition : QgsExpression::Node
@@ -104,4 +104,5 @@ class QgsLabel

private:
QgsLabel (); // pretend that constructor is private for now
QgsLabel( const QgsLabel& rh );
};
@@ -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 );
};
@@ -64,4 +64,6 @@ class QgsPluginLayerRegistry

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

};
@@ -8,6 +8,7 @@ class QgsRenderContext

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

//! Enumeration of flags that affect rendering operations
@@ -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 );
@@ -261,4 +261,8 @@ class QgsVectorFileWriter
protected:
//! @note not available in python bindings
// OGRGeometryH createEmptyGeometry( QGis::WkbType wkbType );

private:

QgsVectorFileWriter( const QgsVectorFileWriter& rh );
};
@@ -76,4 +76,8 @@ class QProgressDialog;

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

private:

QgsVectorLayerImport( const QgsVectorLayerImport& rh );
};
@@ -24,7 +24,8 @@ class QgsRasterPipe
};

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

~QgsRasterPipe();

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

private:

QgsRasterPipe( const QgsRasterPipe& thePipe );

};
@@ -47,4 +47,8 @@ class QgsRasterShader
void writeXML( QDomDocument& doc, QDomElement& parent ) const;

void readXML( const QDomElement& elem );

private:

QgsRasterShader( const QgsRasterShader& rh );
};
@@ -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 */
@@ -306,6 +306,11 @@ class QgsRuleBasedRendererV2 : QgsFeatureRendererV2

protected:
void initFilter();

private:

Rule( const QgsRuleBasedRendererV2::Rule& rh );

};

/////
@@ -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
@@ -195,4 +199,5 @@ class QgsSvgCache : QObject

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

};
@@ -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 );
};


@@ -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 );
};
@@ -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 );
};

@@ -44,4 +44,8 @@ class QgsWFSProjectParser
QSet<QString> wfstInsertLayers() const;
QSet<QString> wfstDeleteLayers() const;

private:

QgsWFSProjectParser( const QgsWFSProjectParser& rh );

};
@@ -103,6 +103,9 @@ class ANALYSIS_EXPORT QgsRasterCalcNode
QString mRasterName;
QgsRasterMatrix* mMatrix;
Operator mOperator;

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


@@ -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
@@ -51,6 +51,11 @@ class QgsVertexEntry
void placeMarker();

void setSelected( bool selected = true );

private:

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

#endif
@@ -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
@@ -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 )
{
@@ -95,6 +95,11 @@ class GEOSInit
{
finishGEOS_r( ctxt );
}

private:

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

static GEOSInit geosinit;
@@ -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
@@ -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;
@@ -261,7 +261,7 @@ inline void ( *cast_to_fptr( void *p ) )()
//
// return a string representation of a double
//
inline QString qgsDoubleToString( const double &a, const int &precision = 17 )
inline QString qgsDoubleToString( double a, int precision = 17 )
{
if ( precision )
return QString::number( a, 'f', precision ).remove( QRegExp( "\\.?0+$" ) );

0 comments on commit 752f6bd

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