]> granicus.if.org Git - icinga2/commitdiff
Respect activation priority also on deactivation 6908/head
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Wed, 6 Feb 2019 10:17:45 +0000 (11:17 +0100)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Wed, 6 Feb 2019 10:17:45 +0000 (11:17 +0100)
lib/base/configobject.cpp

index 9d44db60aadbabf013be3c99cbb8168eb221a19d..bf43dd2ba6668e39955fd87cdee53b21ba9f2f59 100644 (file)
@@ -33,6 +33,7 @@
 #include "base/workqueue.hpp"
 #include "base/context.hpp"
 #include "base/application.hpp"
+#include <algorithm>
 #include <fstream>
 #include <boost/exception/errinfo_api_function.hpp>
 #include <boost/exception/errinfo_errno.hpp>
@@ -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<ConfigType *>(type.get());
 
                if (!dtype)