Showing with 54 additions and 36 deletions.
  1. +3 −2 python/core/qgsfield.sip
  2. +7 −7 python/plugins/fTools/tools/ftools_utils.py
  3. +38 −27 src/app/qgisapp.cpp
  4. +2 −0 src/core/qgscoordinatetransform.cpp
  5. +2 −0 src/core/qgsvectorfilewriter.cpp
  6. +2 −0 src/core/qgsvectorlayer.cpp
5 changes: 3 additions & 2 deletions python/core/qgsfield.sip
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,14 @@ public:
void extend( const QgsFields& other );


QgsField& operator[](int i);
QgsField& operator[](int i) /Factory/;
%MethodCode
int idx = (int)sipConvertFromSequenceIndex(a0, sipCpp->count());
int idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
if (idx < 0)
sipIsErr = 1;
else
sipRes = new QgsField(sipCpp->operator[](idx));

%End

/* SIP_PYOBJECT __getitem__(int key);
Expand Down
14 changes: 7 additions & 7 deletions python/plugins/fTools/tools/ftools_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,17 @@ def testForUniqueness( fieldList1, fieldList2 ):

# Create a unique field name based on input field name
def createUniqueFieldName( field ):
check = field.name().right( 2 )
shortName = field.name().left( 8 )
if check.startsWith("_"):
( val, test ) = check.right( 1 ).toInt()
if test:
check = field.name()[-2:]
shortName = field.name()[:8]
if check[0] == "_":
try:
val = int( check[-1:] )
if val < 2:
val = 2
else:
val = val + 1
field.setName( shortName.left( len( shortName )-1 ) + unicode( val ) )
else:
field.setName( shortName[len( shortName )-1:] + unicode( val ) )
except exceptions.ValueError:
field.setName( shortName + "_2" )
else:
field.setName( shortName + "_2" )
Expand Down
65 changes: 38 additions & 27 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,44 +745,46 @@ QgisApp::~QgisApp()
#ifdef HAVE_TOUCH
delete mMapTools.mTouch;
#endif
delete mMapTools.mIdentify;
delete mMapTools.mAddFeature;
delete mMapTools.mAddPart;
delete mMapTools.mAddRing;
delete mMapTools.mAnnotation;
delete mMapTools.mChangeLabelProperties;
delete mMapTools.mDeletePart;
delete mMapTools.mDeleteRing;
delete mMapTools.mFeatureAction;
delete mMapTools.mMeasureDist;
delete mMapTools.mMeasureArea;
delete mMapTools.mMeasureAngle;
delete mMapTools.mTextAnnotation;
delete mMapTools.mFormAnnotation;
delete mMapTools.mHtmlAnnotation;
delete mMapTools.mSvgAnnotation;
delete mMapTools.mAnnotation;
delete mMapTools.mAddFeature;
delete mMapTools.mIdentify;
delete mMapTools.mMeasureAngle;
delete mMapTools.mMeasureArea;
delete mMapTools.mMeasureDist;
delete mMapTools.mMoveFeature;
delete mMapTools.mMoveLabel;
delete mMapTools.mNodeTool;
delete mMapTools.mOffsetCurve;
delete mMapTools.mPinLabels;
delete mMapTools.mReshapeFeatures;
delete mMapTools.mSplitFeatures;
delete mMapTools.mRotateFeature;
delete mMapTools.mRotateLabel;
delete mMapTools.mRotatePointSymbolsTool;
delete mMapTools.mSelect;
delete mMapTools.mSelectRectangle;
delete mMapTools.mSelectPolygon;
delete mMapTools.mSelectFreehand;
delete mMapTools.mSelectPolygon;
delete mMapTools.mSelectRadius;
delete mMapTools.mAddRing;
delete mMapTools.mSimplifyFeature;
delete mMapTools.mDeleteRing;
delete mMapTools.mDeletePart;
delete mMapTools.mAddPart;
delete mMapTools.mNodeTool;
delete mMapTools.mRotatePointSymbolsTool;
delete mMapTools.mPinLabels;
delete mMapTools.mSelectRectangle;
delete mMapTools.mShowHideLabels;
delete mMapTools.mMoveLabel;
delete mMapTools.mRotateFeature;
delete mMapTools.mRotateLabel;
delete mMapTools.mChangeLabelProperties;
delete mMapTools.mOffsetCurve;
delete mMapTools.mSimplifyFeature;
delete mMapTools.mSplitFeatures;
delete mMapTools.mSvgAnnotation;
delete mMapTools.mTextAnnotation;

delete mPythonUtils;
delete mpMaptip;

delete mpGpsWidget;

delete mOverviewMapCursor;

deletePrintComposers();
removeAnnotationItems();

Expand All @@ -791,6 +793,11 @@ QgisApp::~QgisApp()

// delete map layer registry and provider registry
QgsApplication::exitQgis();

delete QgsProject::instance();

mPythonUtils->exitPython();
delete mPythonUtils;
}

void QgisApp::dragEnterEvent( QDragEnterEvent *event )
Expand Down Expand Up @@ -1330,7 +1337,7 @@ void QgisApp::createMenus()
// Help menu
// add What's this button to it
QAction* before = mActionHelpAPI;
mHelpMenu->insertAction( before, QWhatsThis::createAction() );
mHelpMenu->insertAction( before, QWhatsThis::createAction( this ) );
}

void QgisApp::createToolBars()
Expand Down Expand Up @@ -1457,7 +1464,7 @@ void QgisApp::createToolBars()

// Help Toolbar

mHelpToolBar->addAction( QWhatsThis::createAction() );
mHelpToolBar->addAction( QWhatsThis::createAction( this ) );

}

Expand Down Expand Up @@ -2173,6 +2180,10 @@ bool QgisApp::createDB()
return false;
}
}
else
{
sqlite3_free( errmsg );
}

if ( sqlite3_exec( db, "DROP VIEW vw_srs", 0, 0, &errmsg ) != SQLITE_OK )
{
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgscoordinatetransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ void QgsCoordinateTransform::initialise()
}

// init the projections (destination and source)
pj_free( mDestinationProjection );
mDestinationProjection = pj_init_plus( mDestCRS.toProj4().toUtf8() );
pj_free( mSourceProjection );
mSourceProjection = pj_init_plus( mSourceCRS.toProj4().toUtf8() );

#ifdef COORDINATE_TRANSFORM_VERBOSE
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsvectorfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,10 @@ QgsVectorFileWriter::QgsVectorFileWriter(
.arg( attrField.name() )
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) );
mError = ErrAttributeCreationFailed;
OGR_Fld_Destroy( fld );
return;
}
OGR_Fld_Destroy( fld );

int ogrIdx = OGR_FD_GetFieldIndex( defn, mCodec->fromUnicode( attrField.name() ) );
if ( ogrIdx < 0 )
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ QgsVectorLayer::~QgsVectorLayer()

delete mActions;

delete mRendererV2;

//delete remaining overlays

QList<QgsVectorOverlay*>::iterator overlayIt = mOverlays.begin();
Expand Down