Skip to content

Commit

Permalink
fix removal of temporary directories
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Mar 31, 2019
1 parent ca80fb6 commit b141349
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 26 deletions.
1 change: 1 addition & 0 deletions python/core/auto_generated/qgsarchive.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@




class QgsArchive
{
%Docstring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@





class QgsFetchedContent : QObject
{
%Docstring
Expand Down
3 changes: 1 addition & 2 deletions src/core/qgsarchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "qgsziputils.h"
#include "qgsmessagelog.h"
#include "qgsauxiliarystorage.h"
#include <iostream>

#include <QStandardPaths>
#include <QUuid>
Expand All @@ -32,7 +31,7 @@ QgsArchive::QgsArchive()

QgsArchive::QgsArchive( const QgsArchive &other )
: mFiles( other.mFiles )
, mDir( new QTemporaryDir() )
, mDir( new QTemporaryDir() )
{
}

Expand Down
1 change: 1 addition & 0 deletions src/core/qgsarchive.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define QGSARCHIVE_H

#include "qgis_core.h"

#include <QStringList>
#include <QTemporaryFile>
#include <QTemporaryDir>
Expand Down
1 change: 0 additions & 1 deletion src/core/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <cmath>

#include <QDir>
#include <QTemporaryFile>
#include <QDomNode>
#include <QDomElement>
#include <QFileInfo>
Expand Down
5 changes: 1 addition & 4 deletions src/core/qgsnetworkcontentfetcherregistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@
#include <QMap>
#include <QMutex>
#include <QNetworkReply>
#include <QTemporaryFile>

#include "qgis_core.h"

class QTemporaryFile;

#include "qgstaskmanager.h"
#include "qgsnetworkcontentfetchertask.h"

class QTemporaryFile;

/**
* \class QgsFetchedContent
Expand Down
19 changes: 11 additions & 8 deletions src/core/qgsproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
#endif

// canonical project instance
QgsProject *QgsProject::sProject = nullptr;
std::unique_ptr<QgsProject> QgsProject::sProject;

/**
Take the given scope and key and convert them to a string list of key
Expand Down Expand Up @@ -410,30 +410,33 @@ QgsProject::~QgsProject()
{
mIsBeingDeleted = true;

clear();
if ( this != sProject.get() )
clear();

delete mBadLayerHandler;
delete mRelationManager;
delete mLayerTreeRegistryBridge;
delete mRootGroup;
if ( this == sProject )

if ( this == sProject.get() )
{
sProject = nullptr;
sProject.release();
}
}

void QgsProject::setInstance( QgsProject *project )
{
sProject = project;
sProject.reset( project );
}


QgsProject *QgsProject::instance()
{
if ( !sProject )
if ( !sProject.get() )
{
sProject = new QgsProject;
sProject.reset( new QgsProject );
}
return sProject;
return sProject.get();
}

void QgsProject::setTitle( const QString &title )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproject.h
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera

private:

static QgsProject *sProject;
static std::unique_ptr<QgsProject> sProject;

/**
* Set the current project instance to \a project
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgssettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@


#include <cstdlib>

#include <QFileInfo>
#include <QSettings>
#include <QDir>
#include <QCoreApplication>

#include "qgssettings.h"
#include "qgslogger.h"
Expand Down
2 changes: 1 addition & 1 deletion src/crssync/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ int main( int argc, char **argv )
std::cout << -res << " CRSs could not be updated." << std::endl;
}

exit( 0 );
return 0;
}
1 change: 0 additions & 1 deletion src/gui/qgscolorbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "qgsguiutils.h"

#include <QPainter>
#include <QTemporaryFile>
#include <QMouseEvent>
#include <QMenu>
#include <QClipboard>
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgscolorbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#include <QColorDialog>
#include <QToolButton>
#include <QTemporaryFile>
#include "qgis_gui.h"
#include "qgis_sip.h"

Expand Down
3 changes: 3 additions & 0 deletions src/gui/symbology/qgsstyleexportimportdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
#include <QCloseEvent>
#include <QFileDialog>
#include <QMessageBox>
#include <QProgressDialog>
#include <QPushButton>
#include <QStandardItemModel>
#include <QNetworkAccessManager>
#include <QNetworkReply>


QgsStyleExportImportDialog::QgsStyleExportImportDialog( QgsStyle *style, QWidget *parent, Mode mode )
Expand Down
9 changes: 4 additions & 5 deletions src/gui/symbology/qgsstyleexportimportdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@

#include <QDialog>
#include <QUrl>
#include <QProgressDialog>
#include <QTemporaryFile>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QStandardItem>

#include "ui_qgsstyleexportimportdialogbase.h"
#include "qgis_gui.h"
Expand All @@ -36,6 +31,10 @@ class QgsStyle;
class QgsStyleGroupSelectionDialog;
class QgsTemporaryCursorOverride;
class QgsStyleModel;
class QTemporaryFile;
class QProgressDialog;
class QNetworkAccessManager;
class QNetworkReply;

/**
* \ingroup gui
Expand Down

1 comment on commit b141349

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jef-n I've reverted in 9820e6b - this fix needs reworking as it's broken almost all the unit tests

Please sign in to comment.