Skip to content

Commit 2afbf95

Browse files
author
jef
committedApr 19, 2011
fix crashes on exit (follows up r15751)
git-svn-id: http://svn.osgeo.org/qgis/trunk@15773 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent b6eab61 commit 2afbf95

File tree

5 files changed

+42
-40
lines changed

5 files changed

+42
-40
lines changed
 

‎src/core/qgscoordinatetransform.cpp

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,43 @@ extern "C"
3232
// if defined shows all information about transform to stdout
3333
// #define COORDINATE_TRANSFORM_VERBOSE
3434

35-
QgsCoordinateTransform::QgsCoordinateTransform( ) : QObject(), mSourceCRS(), mDestCRS()
35+
QgsCoordinateTransform::QgsCoordinateTransform()
36+
: QObject()
37+
, mInitialisedFlag( false )
38+
, mSourceProjection( 0 )
39+
, mDestinationProjection( 0 )
3640
{
3741
setFinder();
3842
}
3943

40-
QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSystem& source,
41-
const QgsCoordinateReferenceSystem& dest )
44+
QgsCoordinateTransform::QgsCoordinateTransform( const QgsCoordinateReferenceSystem& source, const QgsCoordinateReferenceSystem& dest )
45+
: QObject()
46+
, mInitialisedFlag( false )
47+
, mSourceProjection( 0 )
48+
, mDestinationProjection( 0 )
4249
{
4350
setFinder();
44-
4551
mSourceCRS = source;
4652
mDestCRS = dest;
4753
initialise();
4854
}
4955

5056
QgsCoordinateTransform::QgsCoordinateTransform( long theSourceSrsId, long theDestSrsId )
51-
: mSourceCRS( theSourceSrsId, QgsCoordinateReferenceSystem::InternalCrsId ),
52-
mDestCRS( theDestSrsId, QgsCoordinateReferenceSystem::InternalCrsId )
57+
: QObject()
58+
, mInitialisedFlag( false )
59+
, mSourceCRS( theSourceSrsId, QgsCoordinateReferenceSystem::InternalCrsId )
60+
, mDestCRS( theDestSrsId, QgsCoordinateReferenceSystem::InternalCrsId )
61+
, mSourceProjection( 0 )
62+
, mDestinationProjection( 0 )
5363
{
5464
initialise();
5565
}
5666

57-
QgsCoordinateTransform::QgsCoordinateTransform( QString theSourceCRS, QString theDestCRS ) : QObject()
58-
67+
QgsCoordinateTransform::QgsCoordinateTransform( QString theSourceCRS, QString theDestCRS )
68+
: QObject()
69+
, mInitialisedFlag( false )
70+
, mSourceProjection( 0 )
71+
, mDestinationProjection( 0 )
5972
{
6073
setFinder();
6174
mSourceCRS.createFromWkt( theSourceCRS );
@@ -69,7 +82,11 @@ QgsCoordinateTransform::QgsCoordinateTransform( QString theSourceCRS, QString th
6982

7083
QgsCoordinateTransform::QgsCoordinateTransform( long theSourceSrid,
7184
QString theDestWkt,
72-
QgsCoordinateReferenceSystem::CrsType theSourceCRSType ): QObject()
85+
QgsCoordinateReferenceSystem::CrsType theSourceCRSType )
86+
: QObject()
87+
, mInitialisedFlag( false )
88+
, mSourceProjection( 0 )
89+
, mDestinationProjection( 0 )
7390
{
7491
setFinder();
7592

@@ -85,11 +102,11 @@ QgsCoordinateTransform::QgsCoordinateTransform( long theSourceSrid,
85102
QgsCoordinateTransform::~QgsCoordinateTransform()
86103
{
87104
// free the proj objects
88-
if ( mSourceProjection != 0 )
105+
if ( mSourceProjection )
89106
{
90107
pj_free( mSourceProjection );
91108
}
92-
if ( mDestinationProjection != 0 )
109+
if ( mDestinationProjection )
93110
{
94111
pj_free( mDestinationProjection );
95112
}
@@ -106,7 +123,6 @@ void QgsCoordinateTransform::setDestCRS( const QgsCoordinateReferenceSystem& the
106123
initialise();
107124
}
108125

109-
110126
void QgsCoordinateTransform::setDestCRSID( long theCRSID )
111127
{
112128
//!todo Add some logic here to determine if the srsid is a system or user one
@@ -118,11 +134,6 @@ void QgsCoordinateTransform::setDestCRSID( long theCRSID )
118134
// And probably shouldn't be a void
119135
void QgsCoordinateTransform::initialise()
120136
{
121-
122-
mInitialisedFlag = false; //guilty until proven innocent...
123-
mSourceProjection = NULL;
124-
mDestinationProjection = NULL;
125-
126137
// XXX Warning - multiple return paths in this block!!
127138
if ( !mSourceCRS.isValid() )
128139
{
@@ -152,11 +163,11 @@ void QgsCoordinateTransform::initialise()
152163
#endif
153164

154165
mInitialisedFlag = true;
155-
if ( mDestinationProjection == NULL )
166+
if ( !mDestinationProjection )
156167
{
157168
mInitialisedFlag = false;
158169
}
159-
if ( mSourceProjection == NULL )
170+
if ( !mSourceProjection )
160171
{
161172
mInitialisedFlag = false;
162173
}

‎src/core/qgsdataprovider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class CORE_EXPORT QgsDataProvider : public QObject
298298
* @param changed binary combination of changes
299299
* @note added in 1.7
300300
*/
301-
void dataChanged( int change );
301+
void dataChanged( int changed );
302302

303303
protected:
304304
/**

‎src/plugins/offline_editing/offline_editing.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ QgsOfflineEditing::QgsOfflineEditing( QgsOfflineEditingProgressDialog* progressD
5858

5959
QgsOfflineEditing::~QgsOfflineEditing()
6060
{
61-
if ( mProgressDialog != NULL )
62-
{
63-
delete mProgressDialog;
64-
}
65-
disconnect( QgsMapLayerRegistry::instance(), SIGNAL( layerWasAdded( QgsMapLayer* ) ), this, SLOT( layerAdded( QgsMapLayer* ) ) );
6661
}
6762

6863
/**

‎src/plugins/offline_editing/offline_editing_plugin.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,17 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
3535
static const QString sPluginIcon = ":/offline_editing/offline_editing_copy.png";
3636

3737
QgsOfflineEditingPlugin::QgsOfflineEditingPlugin( QgisInterface* theQgisInterface )
38-
: QgisPlugin( sName, sDescription, sPluginVersion, sPluginType ),
39-
mQGisIface( theQgisInterface ),
40-
mActionConvertProject( NULL ),
41-
mActionSynchronize( NULL ),
42-
mOfflineEditing( NULL )
38+
: QgisPlugin( sName, sDescription, sPluginVersion, sPluginType )
39+
, mQGisIface( theQgisInterface )
40+
, mActionConvertProject( NULL )
41+
, mActionSynchronize( NULL )
42+
, mOfflineEditing( NULL )
4343
{
4444
}
4545

4646
QgsOfflineEditingPlugin::~QgsOfflineEditingPlugin()
4747
{
48-
if ( mOfflineEditing != NULL )
49-
{
50-
delete mOfflineEditing;
51-
}
48+
delete mOfflineEditing;
5249
}
5350

5451
void QgsOfflineEditingPlugin::initGui()

‎src/plugins/spatialquery/qgsspatialqueryplugin.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,17 @@ static const QString icon_ = ":/icons/spatialquery.png";
5959
* @parma mIface Pointer to the QGIS interface object
6060
*/
6161
QgsSpatialQueryPlugin::QgsSpatialQueryPlugin( QgisInterface* iface )
62-
: QgisPlugin( name_, description_, version_, type_ ),
63-
mIface( iface )
62+
: QgisPlugin( name_, description_, version_, type_ )
63+
, mDialog( 0 )
64+
, mIface( iface )
65+
, mSpatialQueryAction( 0 )
6466
{
65-
mDialog = NULL;
6667
}
6768

6869
QgsSpatialQueryPlugin::~QgsSpatialQueryPlugin()
6970
{
70-
mIface = NULL;
71-
delete mSpatialQueryAction;
72-
delete mDialog;
7371
}
72+
7473
/*
7574
* Initialize the GUI interface for the plugin
7675
*/

0 commit comments

Comments
 (0)