Skip to content

Commit

Permalink
Add QgsStyle::cleanDefaultStyle() and use it in QgsApplication::exitQ…
Browse files Browse the repository at this point in the history
…gis()
  • Loading branch information
rouault committed Jun 3, 2018
1 parent 8aeb2f6 commit b21701b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/core/auto_generated/symbology/qgsstyle.sip.in
Expand Up @@ -134,6 +134,7 @@ returns 0 if not found
Returns default application-wide style
%End


bool tagSymbol( StyleEntity type, const QString &symbol, const QStringList &tags );
%Docstring
Tags the symbol with the tags in the list
Expand Down
3 changes: 3 additions & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -47,6 +47,7 @@
#include "qgs3drendererregistry.h"
#include "qgslayoutrendercontext.h"
#include "qgssqliteutils.h"
#include "qgsstyle.h"

#include "gps/qgsgpsconnectionregistry.h"
#include "processing/qgsprocessingregistry.h"
Expand Down Expand Up @@ -1084,6 +1085,8 @@ void QgsApplication::exitQgis()

delete QgsProviderRegistry::instance();

QgsStyle::cleanDefaultStyle();

// tear-down GDAL/OGR
OGRCleanupAll();
GDALDestroyDriverManager();
Expand Down
5 changes: 5 additions & 0 deletions src/core/symbology/qgsstyle.cpp
Expand Up @@ -68,6 +68,11 @@ QgsStyle *QgsStyle::defaultStyle() // static
return sDefaultStyle;
}

void QgsStyle::cleanDefaultStyle() // static
{
delete sDefaultStyle;
sDefaultStyle = nullptr;
}

void QgsStyle::clear()
{
Expand Down
3 changes: 3 additions & 0 deletions src/core/symbology/qgsstyle.h
Expand Up @@ -167,6 +167,9 @@ class CORE_EXPORT QgsStyle : public QObject
//! Returns default application-wide style
static QgsStyle *defaultStyle();

//! Deletes the default style. Only to be used by QgsApplication::exitQgis()
static void cleanDefaultStyle() SIP_SKIP;

/**
* Tags the symbol with the tags in the list
*
Expand Down

0 comments on commit b21701b

Please sign in to comment.