removing empty AppliedClassProperties objects

This commit is contained in:
Konstantin Käfer
2014-07-01 12:50:08 +02:00
parent b9fbb4f80b
commit 475f0481b3
4 changed files with 29 additions and 3 deletions

View File

@@ -290,8 +290,18 @@ bool StyleLayer::hasTransitions() const {
void StyleLayer::cleanupAppliedStyleProperties(timestamp now) {
for (std::pair<const PropertyKey, AppliedClassProperties> &pair : appliedStyle) {
pair.second.cleanup(now);
auto it = appliedStyle.begin();
const auto end = appliedStyle.end();
while (it != end) {
AppliedClassProperties &properties = it->second;
properties.cleanup(now);
// If the current properties object is empty, remove it from the map entirely.
if (properties.empty()) {
appliedStyle.erase(it++);
} else {
++it;
}
}
}