diff -r b4beff48bb7a -r be056e87c8ca src/documentmanager.cpp --- a/src/documentmanager.cpp Wed May 25 17:42:02 2022 +0300 +++ b/src/documentmanager.cpp Wed May 25 17:47:06 2022 +0300 @@ -380,11 +380,9 @@ void DocumentManager::modelModified() { Model* model = qobject_cast(this->sender()); - for (auto it = this->openModels.begin(); it != this->openModels.end(); ++it) { - if (model == it->second.model.get()) { - this->polygonCaches[it->second.id].needRecache = true; - break; - } + const std::optional modelId = this->findIdForModel(model); + if (modelId.has_value()) { + this->polygonCaches[*modelId].needRecache = true; } }