Skip to content

Commit b21701b

Browse files
committedJun 3, 2018
Add QgsStyle::cleanDefaultStyle() and use it in QgsApplication::exitQgis()
1 parent 8aeb2f6 commit b21701b

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed
 

‎python/core/auto_generated/symbology/qgsstyle.sip.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ returns 0 if not found
134134
Returns default application-wide style
135135
%End
136136

137+
137138
bool tagSymbol( StyleEntity type, const QString &symbol, const QStringList &tags );
138139
%Docstring
139140
Tags the symbol with the tags in the list

‎src/core/qgsapplication.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "qgs3drendererregistry.h"
4848
#include "qgslayoutrendercontext.h"
4949
#include "qgssqliteutils.h"
50+
#include "qgsstyle.h"
5051

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

10851086
delete QgsProviderRegistry::instance();
10861087

1088+
QgsStyle::cleanDefaultStyle();
1089+
10871090
// tear-down GDAL/OGR
10881091
OGRCleanupAll();
10891092
GDALDestroyDriverManager();

‎src/core/symbology/qgsstyle.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ QgsStyle *QgsStyle::defaultStyle() // static
6868
return sDefaultStyle;
6969
}
7070

71+
void QgsStyle::cleanDefaultStyle() // static
72+
{
73+
delete sDefaultStyle;
74+
sDefaultStyle = nullptr;
75+
}
7176

7277
void QgsStyle::clear()
7378
{

‎src/core/symbology/qgsstyle.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ class CORE_EXPORT QgsStyle : public QObject
167167
//! Returns default application-wide style
168168
static QgsStyle *defaultStyle();
169169

170+
//! Deletes the default style. Only to be used by QgsApplication::exitQgis()
171+
static void cleanDefaultStyle() SIP_SKIP;
172+
170173
/**
171174
* Tags the symbol with the tags in the list
172175
*

0 commit comments

Comments
 (0)
Please sign in to comment.