Stop object in reversed activation priority order

This stops the checker component first, then notifications, then
features, then config objects, then the API feature and logger(s).

Patch taken from @al2klimov
This commit is contained in:
Michael Friedrich 2019-02-20 12:38:57 +01:00
parent 9d5dc4afc1
commit a25e2b1038
1 changed files with 9 additions and 1 deletions

View File

@ -617,7 +617,15 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes)
void ConfigObject::StopObjects()
{
for (const Type::Ptr& type : Type::GetAllTypes()) {
std::vector<Type::Ptr> types = Type::GetAllTypes();
std::sort(types.begin(), types.end(), [](const Type::Ptr& a, const Type::Ptr& b) {
if (a->GetActivationPriority() > b->GetActivationPriority())
return true;
return false;
});
for (const Type::Ptr& type : types) {
auto *dtype = dynamic_cast<ConfigType *>(type.get());
if (!dtype)