Skip to content

Commit 9cdb640

Browse files
committed
Replace use of deprecated std::auto_ptr with QScopedPointer
1 parent a4ee405 commit 9cdb640

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

src/core/qgsproject.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ QgsProject::~QgsProject()
354354
delete mRelationManager;
355355
delete mRootGroup;
356356

357-
// note that std::auto_ptr automatically deletes imp_ when it's destroyed
357+
// note that QScopedPointer automatically deletes imp_ when it's destroyed
358358
} // QgsProject dtor
359359

360360

@@ -818,8 +818,7 @@ bool QgsProject::read()
818818
{
819819
clearError();
820820

821-
std::auto_ptr< QDomDocument > doc =
822-
std::auto_ptr < QDomDocument > ( new QDomDocument( "qgis" ) );
821+
QScopedPointer<QDomDocument> doc( new QDomDocument( "qgis" ) );
823822

824823
if ( !imp_->file.open( QIODevice::ReadOnly | QIODevice::Text ) )
825824
{
@@ -1064,9 +1063,7 @@ bool QgsProject::write()
10641063
QDomDocumentType documentType =
10651064
DomImplementation.createDocumentType( "qgis", "http://mrcc.com/qgis.dtd",
10661065
"SYSTEM" );
1067-
std::auto_ptr < QDomDocument > doc =
1068-
std::auto_ptr < QDomDocument > ( new QDomDocument( documentType ) );
1069-
1066+
QScopedPointer<QDomDocument> doc( new QDomDocument( documentType ) );
10701067

10711068
QDomElement qgisNode = doc->createElement( "qgis" );
10721069
qgisNode.setAttribute( "projectname", title() );

src/core/qgsproject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ class CORE_EXPORT QgsProject : public QObject
400400
struct Imp;
401401

402402
/// implementation handle
403-
std::auto_ptr<Imp> imp_;
403+
QScopedPointer<Imp> imp_;
404404

405405
static QgsProject * theProject_;
406406

src/gui/qgisgui.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ namespace QgisGui
137137
}
138138
#else
139139
//create a file dialog using the filter list generated above
140-
std::auto_ptr<QFileDialog> fileDialog( new QFileDialog( theParent, theMessage, initialPath, QStringList( filterMap.keys() ).join( ";;" ) ) );
140+
QScopedPointer<QFileDialog> fileDialog( new QFileDialog( theParent, theMessage, initialPath, QStringList( filterMap.keys() ).join( ";;" ) ) );
141141

142142
// allow for selection of more than one file
143143
fileDialog->setFileMode( QFileDialog::AnyFile );

src/gui/qgsmapcanvas.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ QgsMapCanvas::~QgsMapCanvas()
288288
mScene->deleteLater(); // crashes in python tests on windows
289289

290290
delete mMapRenderer;
291-
// mCanvasProperties auto-deleted via std::auto_ptr
291+
// mCanvasProperties auto-deleted via QScopedPointer
292292
// CanvasProperties struct has its own dtor for freeing resources
293293

294294
if ( mJob )

src/gui/qgsmapcanvas.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
555555
class CanvasProperties;
556556

557557
/// Handle pattern for implementation object
558-
std::auto_ptr<CanvasProperties> mCanvasProperties;
558+
QScopedPointer<CanvasProperties> mCanvasProperties;
559559

560560
/**debugging member
561561
invoked when a connect() is made to this object
@@ -570,7 +570,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
570570
/**
571571
@note
572572
573-
Otherwise std::auto_ptr would pass the object responsiblity on to the
573+
Otherwise QScopedPointer would pass the object responsiblity on to the
574574
copy like a hot potato leaving the copyer in a weird state.
575575
*/
576576
QgsMapCanvas( QgsMapCanvas const & );

0 commit comments

Comments
 (0)