From: Alexander A. Klimov Date: Wed, 6 Feb 2019 10:17:45 +0000 (+0100) Subject: Respect activation priority also on deactivation X-Git-Tag: v2.11.0-rc1~227^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ad1717055683c573f81181c7749ba422fa96d13;p=icinga2 Respect activation priority also on deactivation --- diff --git a/lib/base/configobject.cpp b/lib/base/configobject.cpp index 9d44db60a..bf43dd2ba 100644 --- a/lib/base/configobject.cpp +++ b/lib/base/configobject.cpp @@ -33,6 +33,7 @@ #include "base/workqueue.hpp" #include "base/context.hpp" #include "base/application.hpp" +#include #include #include #include @@ -617,7 +618,13 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes) void ConfigObject::StopObjects() { - for (const Type::Ptr& type : Type::GetAllTypes()) { + auto types = Type::GetAllTypes(); + + std::sort(types.begin(), types.end(), [](const Type::Ptr& a, const Type::Ptr& b) { + return a->GetActivationPriority() > b->GetActivationPriority(); + }); + + for (const Type::Ptr& type : types) { auto *dtype = dynamic_cast(type.get()); if (!dtype)