plasma: remove redundant connection to QCoreApplication::aboutTOQuit() signal

at the point where the application is about to exit it is not safe to even
access the global static (by calling Plasma::Theme::defaultTheme()) since
it will be deleted

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-11-05 04:22:58 +02:00
parent 2b2ac283e8
commit d37ea70af9
2 changed files with 6 additions and 19 deletions

View file

@ -145,7 +145,6 @@ public:
bool useCache();
void settingsFileChanged(const QString &);
void setThemeName(const QString &themeName, bool writeSettings);
void onAppExitCleanup();
void processWallpaperSettings(KConfigBase *metadata);
void processAnimationSettings(const QString &theme, KConfigBase *metadata);
@ -244,14 +243,6 @@ bool ThemePrivate::useCache()
return cacheTheme;
}
void ThemePrivate::onAppExitCleanup()
{
pixmapsToCache.clear();
delete pixmapCache;
pixmapCache = 0;
cacheTheme = false;
}
QString ThemePrivate::findInTheme(const QString &image, const QString &theme, bool cache)
{
if (cache && discoveries.contains(image)) {
@ -460,10 +451,6 @@ Theme::Theme(QObject *parent)
d(new ThemePrivate(this))
{
settingsChanged();
if (QCoreApplication::instance()) {
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()),
this, SLOT(onAppExitCleanup()));
}
}
Theme::Theme(const QString &themeName, QObject *parent)
@ -475,14 +462,16 @@ Theme::Theme(const QString &themeName, QObject *parent)
d->cacheTheme = false;
setThemeName(themeName);
d->cacheTheme = useCache;
if (QCoreApplication::instance()) {
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()),
this, SLOT(onAppExitCleanup()));
}
}
Theme::~Theme()
{
d->cacheTheme = false;
d->pixmapsToCache.clear();
delete d->pixmapCache;
d->pixmapCache = 0;
if (d->svgElementsCache) {
QHashIterator<QString, QSet<QString> > it(d->invalidElements);
while (it.hasNext()) {
@ -492,7 +481,6 @@ Theme::~Theme()
}
}
d->onAppExitCleanup();
delete d;
}

View file

@ -398,7 +398,6 @@ class PLASMA_EXPORT Theme : public QObject
Q_PRIVATE_SLOT(d, void colorsChanged())
Q_PRIVATE_SLOT(d, void settingsFileChanged(const QString &))
Q_PRIVATE_SLOT(d, void scheduledCacheUpdate())
Q_PRIVATE_SLOT(d, void onAppExitCleanup())
Q_PRIVATE_SLOT(d, void notifyOfChanged())
};