Skip to content
Permalink
Browse files

fix removal of temporary directories (fixes #21292)

(cherry picked from commit 8851328)
  • Loading branch information
jef-n committed Apr 1, 2019
1 parent d3ec6b5 commit c5a2c2fe78b32ff2a1f1fd3002505d7fee56be5e
@@ -9,6 +9,7 @@




class QgsArchive
{
%Docstring
@@ -11,8 +11,6 @@





class QgsFetchedContent : QObject
{
%Docstring
@@ -130,6 +130,7 @@ const char *QgsApplication::QGIS_ORGANIZATION_DOMAIN = "qgis.org";
const char *QgsApplication::QGIS_APPLICATION_NAME = "QGIS3";

QgsApplication::ApplicationMembers *QgsApplication::sApplicationMembers = nullptr;
QgsAuthManager *QgsApplication::sAuthManager = nullptr;

QgsApplication::QgsApplication( int &argc, char **argv, bool GUIenabled, const QString &profileFolder, const QString &platformName )
: QApplication( argc, argv, GUIenabled )
@@ -1167,7 +1168,6 @@ QgsAuthManager *QgsApplication::authManager()
else
{
// no QgsApplication instance
static QgsAuthManager *sAuthManager = nullptr;
if ( !sAuthManager )
sAuthManager = QgsAuthManager::instance();
return sAuthManager;
@@ -1177,7 +1177,11 @@ QgsAuthManager *QgsApplication::authManager()

void QgsApplication::exitQgis()
{
delete QgsApplication::authManager();
// don't create to delete
if ( instance() )
delete instance()->mAuthManager;
else
delete sAuthManager;

//Ensure that all remaining deleteLater QObjects are actually deleted before we exit.
//This isn't strictly necessary (since we're exiting anyway) but doing so prevents a lot of
@@ -885,6 +885,8 @@ class CORE_EXPORT QgsApplication : public QApplication
// ... but in case QgsApplication is never instantiated (eg with custom designer widgets), we fall back to static members
static ApplicationMembers *sApplicationMembers;

static QgsAuthManager *sAuthManager;

static ApplicationMembers *members();
};

@@ -20,7 +20,6 @@
#include "qgsziputils.h"
#include "qgsmessagelog.h"
#include "qgsauxiliarystorage.h"
#include <iostream>

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

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

@@ -20,6 +20,7 @@
#define QGSARCHIVE_H

#include "qgis_core.h"

#include <QStringList>
#include <QTemporaryFile>
#include <QTemporaryDir>
@@ -21,7 +21,6 @@
#include <cmath>

#include <QDir>
#include <QTemporaryFile>
#include <QDomNode>
#include <QDomElement>
#include <QFileInfo>
@@ -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
@@ -1507,6 +1507,9 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera

friend class QgsProjectDirtyBlocker;

// Required to avoid creating a new project in it's destructor
friend class QgsProviderRegistry;

// Required by QGIS Server for switching the current project instance
friend class QgsConfigCache;
};
@@ -264,7 +264,9 @@ typedef void cleanupProviderFunction_t();

void QgsProviderRegistry::clean()
{
QgsProject::instance()->removeAllMapLayers();
// avoid recreating a new project just to clean it
if ( QgsProject::sProject )
QgsProject::instance()->removeAllMapLayers();

Providers::const_iterator it = mProviders.begin();

@@ -15,6 +15,7 @@


#include <cstdlib>

#include <QFileInfo>
#include <QSettings>
#include <QDir>
@@ -2,6 +2,7 @@ ADD_EXECUTABLE(crssync main.cpp)

INCLUDE_DIRECTORIES(
../core
../core/expression
../core/geometry
../core/metadata
${CMAKE_BINARY_DIR}/src/core
@@ -18,6 +18,7 @@
#include "qgsapplication.h"
#include "qgscoordinatereferencesystem.h"
#include "qgsconfig.h"
#include "qgsproject.h"

#include <QRegExp>

@@ -84,5 +85,7 @@ int main( int argc, char **argv )
std::cout << -res << " CRSs could not be updated." << std::endl;
}

exit( 0 );
QgsApplication::exitQgis();

return 0;
}
@@ -26,7 +26,6 @@
#include "qgsguiutils.h"

#include <QPainter>
#include <QTemporaryFile>
#include <QMouseEvent>
#include <QMenu>
#include <QClipboard>
@@ -17,7 +17,6 @@

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

@@ -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 )
@@ -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"
@@ -36,6 +31,10 @@ class QgsStyle;
class QgsStyleGroupSelectionDialog;
class QgsTemporaryCursorOverride;
class QgsStyleModel;
class QTemporaryFile;
class QProgressDialog;
class QNetworkAccessManager;
class QNetworkReply;

/**
* \ingroup gui

0 comments on commit c5a2c2f

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