Skip to content

Commit

Permalink
Stop object in reversed activation priority order
Browse files Browse the repository at this point in the history
This stops the checker component first, then notifications, then
features, then config objects, then the API feature and logger(s).

Patch taken from @Al2Klimov
  • Loading branch information
Michael Friedrich committed Feb 20, 2019
1 parent 9d5dc4a commit a25e2b1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/base/configobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a25e2b1

Please sign in to comment.