Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#5893: Fix a signal timing problem when reloading entityDefs. We can'…
…t have the eclass changed signal fired in the middle of re-parsing all the files, since things like entity colours are not resolved at that point yet.
  • Loading branch information
codereader committed Feb 13, 2022
1 parent c475035 commit eb000fc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions radiantcore/eclass/EClassManager.cpp
Expand Up @@ -286,6 +286,13 @@ void EClassManager::forEachModelDef(const std::function<void(const IModelDefPtr&

void EClassManager::reloadDefs()
{
// Block load signals until inheritance of all classes has been completed
// we can't have eclass changed signals emitted before we have that sorted out
for (const auto& eclass : _entityClasses)
{
eclass.second->blockChangedSignal(true);
}

// greebo: Leave all current entityclasses as they are, just invoke the
// FileLoader again. It will parse the files again, and look up
// the eclass names in the existing map. If found, the eclass
Expand All @@ -297,6 +304,13 @@ void EClassManager::reloadDefs()
// Resolve the eclass inheritance again
resolveInheritance();

// Release the lock and emit the signal
for (const auto& eclass : _entityClasses)
{
eclass.second->blockChangedSignal(false);
eclass.second->emitChangedSignal();
}

_defsReloadedSignal.emit();
}

Expand Down

0 comments on commit eb000fc

Please sign in to comment.