Reduce double and triple lookups to the frames hash

Test Plan: Everything runs, tests pass

Reviewers: #plasma, davidedmundson, broulik

Reviewed By: #plasma, davidedmundson, broulik

Subscribers: broulik, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16060
This commit is contained in:
Aleix Pol 2018-10-09 10:00:23 +02:00
parent 4b7bac26cc
commit d9b907e953

View File

@ -958,16 +958,16 @@ QSizeF FrameSvgPrivate::frameSize(FrameData *frame) const
void FrameData::ref(FrameSvg *svg)
{
references[svg] = references[svg] + 1;
references[svg]++;
//qCDebug(LOG_PLASMA) << this << svg << references[svg];
}
bool FrameData::deref(FrameSvg *svg)
{
references[svg] = references[svg] - 1;
//qCDebug(LOG_PLASMA) << this << svg << references[svg];
if (references[svg] < 1) {
references.remove(svg);
auto it = references.find(svg);
(*it)--;
if (*it < 1) {
references.erase(it);
}
return references.isEmpty();