[svg] Always start SvgRectsCache timer from the correct thread

Plasma::Svg is used in from the render thread in updatePaintNode of
various Plasma::*Item classes.

At this point the GUI thread is blocked, so it's probably safe, but it's
still spamming the log file like crazy.
This commit is contained in:
David Edmundson 2020-12-23 01:14:15 +00:00 committed by Kai Uwe Broulik
parent 85f136ff41
commit c1560df1cc

View File

@ -192,7 +192,7 @@ void SvgRectsCache::insert(uint id, const QString &filePath, const QRectF &rect,
m_invalidElements[filePath] << id;
imageGroup.writeEntry("Invalidelements", m_invalidElements[filePath].values());
}
m_configSyncTimer->start();
QMetaObject::invokeMethod(m_configSyncTimer, QOverload<>::of(&QTimer::start));
}
bool SvgRectsCache::findElementRect(Plasma::SvgPrivate::CacheId cacheId, QRectF &rect)
@ -229,7 +229,7 @@ void SvgRectsCache::loadImageFromCache(const QString &path, uint lastModified)
if (lastModified > savedTime) {
imageGroup.deleteGroup();
m_configSyncTimer->start();
QMetaObject::invokeMethod(m_configSyncTimer, QOverload<>::of(&QTimer::start));
return;
}
@ -249,7 +249,7 @@ void SvgRectsCache::dropImageFromCache(const QString &path)
{
KConfigGroup imageGroup(m_svgElementsCache, path);
imageGroup.deleteGroup();
m_configSyncTimer->start();
QMetaObject::invokeMethod(m_configSyncTimer, QOverload<>::of(&QTimer::start));
}
QList<QSize> SvgRectsCache::sizeHintsForId(const QString &path, const QString &id)
@ -290,7 +290,7 @@ void SvgRectsCache::insertSizeHintForId(const QString &path, const QString &id,
m_sizeHintsForId[path % id].append(size);
KConfigGroup imageGroup(m_svgElementsCache, path);
imageGroup.writeEntry(id, sizeListToString(m_sizeHintsForId[path % id]));
m_configSyncTimer->start();
QMetaObject::invokeMethod(m_configSyncTimer, QOverload<>::of(&QTimer::start));
}
QString SvgRectsCache::iconThemePath()
@ -310,7 +310,7 @@ void SvgRectsCache::setIconThemePath(const QString &path)
m_iconThemePath = path;
KConfigGroup imageGroup(m_svgElementsCache, QStringLiteral("General"));
imageGroup.writeEntry(QStringLiteral("IconThemePath"), path);
m_configSyncTimer->start();
QMetaObject::invokeMethod(m_configSyncTimer, QOverload<>::of(&QTimer::start));
}
void SvgRectsCache::expireCache(const QString &path)
@ -335,7 +335,7 @@ void SvgRectsCache::setNaturalSize(const QString &path, qreal scaleFactor, const
// FIXME: needs something faster, perhaps even sprintf
imageGroup.writeEntry(QStringLiteral("NaturalSize_") % QString::number(scaleFactor), size);
m_configSyncTimer->start();
QMetaObject::invokeMethod(m_configSyncTimer, QOverload<>::of(&QTimer::start));
}
QSizeF SvgRectsCache::naturalSize(const QString &path, qreal scaleFactor)
@ -360,7 +360,7 @@ void SvgRectsCache::updateLastModified(const QString &filePath, unsigned int las
{
KConfigGroup imageGroup(m_svgElementsCache, filePath);
imageGroup.writeEntry("LastModified", lastModified);
m_configSyncTimer->start();
QMetaObject::invokeMethod(m_configSyncTimer, QOverload<>::of(&QTimer::start));
}
SvgPrivate::SvgPrivate(Svg *svg)