Skip to content

Commit

Permalink
Do not delete the static Settings instance in its own destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Benni committed Aug 4, 2024
1 parent b81f8fd commit a189118
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 2 additions & 7 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@
#include <QSvgRenderer>


Settings* Settings::m_instance = nullptr;

Settings* Settings::instance()
{
if( !m_instance )
m_instance = new Settings();

return m_instance;
static auto settings = Settings();
return &settings;
}

Settings::Settings( QObject *parent )
Expand All @@ -55,7 +51,6 @@ Settings::Settings( QObject *parent )
Settings::~Settings()
{
delete m_mutex;
delete m_instance;
}

KCardCache* Settings::cardCache()
Expand Down
2 changes: 0 additions & 2 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ class Settings : public QObject
Settings( QObject *parent = 0 );
~Settings();

static Settings* m_instance;

KSharedConfig::Ptr m_config;

QMutex* m_mutex;
Expand Down

0 comments on commit a189118

Please sign in to comment.